-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testscript: expose (*TestScript).stdout via Stdout() (#216)
Similarly, expose (*TestScript).stderr via Stderr(). Closes #139
- Loading branch information
Showing
4 changed files
with
189 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Verify that when we don't update stdout when we don't attempt to write via Stdout() | ||
fprintargs stdout hello stdout from fprintargs | ||
stdout 'hello stdout from fprintargs' | ||
echoandexit 0 | ||
stdout 'hello stdout from fprintargs' | ||
|
||
# Verify that when we don't update stderr when we don't attempt to write via Stderr() | ||
fprintargs stderr hello stderr from fprintargs | ||
stderr 'hello stderr from fprintargs' | ||
echoandexit 0 | ||
stderr 'hello stderr from fprintargs' | ||
|
||
# Verify that we do update stdout when we attempt to write via Stdout() or Stderr() | ||
fprintargs stdout hello stdout from fprintargs | ||
stdout 'hello stdout from fprintargs' | ||
! stderr .+ | ||
echoandexit 0 'hello stdout from echoandexit' | ||
stdout 'hello stdout from echoandexit' | ||
! stderr .+ | ||
fprintargs stdout hello stdout from fprintargs | ||
stdout 'hello stdout from fprintargs' | ||
! stderr .+ | ||
echoandexit 0 '' 'hello stderr from echoandexit' | ||
! stdout .+ | ||
stderr 'hello stderr from echoandexit' | ||
|
||
# Verify that we do update stderr when we attempt to write via Stdout() or Stderr() | ||
fprintargs stderr hello stderr from fprintargs | ||
! stdout .+ | ||
stderr 'hello stderr from fprintargs' | ||
echoandexit 0 'hello stdout from echoandexit' | ||
stdout 'hello stdout from echoandexit' | ||
! stderr .+ | ||
fprintargs stdout hello stdout from fprintargs | ||
stdout 'hello stdout from fprintargs' | ||
! stderr .+ | ||
echoandexit 0 '' 'hello stderr from echoandexit' | ||
! stdout .+ | ||
stderr 'hello stderr from echoandexit' |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Verify that stdout and stderr get set event when a user-builtin | ||
# command aborts. Note that we need to assert against stdout | ||
# because our meta testscript command sees only a single log. | ||
unquote scripts/testscript.txt | ||
! testscript -v scripts | ||
cmpenv stdout stdout.golden | ||
|
||
-- scripts/testscript.txt -- | ||
> printargs hello world | ||
> echoandexit 1 'this is stdout' 'this is stderr' | ||
-- stdout.golden -- | ||
> printargs hello world | ||
[stdout] | ||
["printargs" "hello" "world"] | ||
> echoandexit 1 'this is stdout' 'this is stderr' | ||
[stdout] | ||
this is stdout | ||
[stderr] | ||
this is stderr | ||
FAIL: ${$}WORK${/}scripts${/}testscript.txt:2: told to exit with code 1 |
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