-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't add extra newline to command stdout/stderr
- Loading branch information
1 parent
8de92ce
commit 3b4641a
Showing
3 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
from ccbr_tools.shell import exec_in_context | ||
from ccbr_tools.shell import shell_run, exec_in_context, concat_newline | ||
|
||
|
||
def test_exec(): | ||
assert exec_in_context(print, "hello", "world") == "hello world\n\n" | ||
assert exec_in_context(print, "hello", "world") == "hello world\n" | ||
|
||
|
||
def test_shell_run(): | ||
assert shell_run("echo hello world") == "hello world\n" | ||
|
||
|
||
def test_concat_newline(): | ||
assert all( | ||
[ | ||
concat_newline("hello", "world") == "hello\nworld", | ||
concat_newline("goodbye", "") == "goodbye", | ||
] | ||
) |