-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/testscript: support -update flag
This is exactly equivalent to setting testscript.Params.UpdateScripts
- Loading branch information
Showing
3 changed files
with
121 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# should support the -update flag | ||
|
||
unquote in.txt res.txt | ||
|
||
# Should be an error to use -u with only stdin | ||
stdin in.txt | ||
! testscript -u | ||
stderr 'cannot use -u when reading from stdin' | ||
|
||
# It is ok to use -u when reading from stdin and | ||
# a regular file | ||
testscript -u - in.txt | ||
cmp in.txt res.txt | ||
|
||
-- in.txt -- | ||
>exec printf 'hello\n' | ||
>cmp stdout stdout.txt | ||
> | ||
>-- .gomodproxy/fruit.com_v1.0.0/.mod -- | ||
>module fruit.com | ||
> | ||
>-- .gomodproxy/fruit.com_v1.0.0/.info -- | ||
>{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} | ||
> | ||
>-- .gomodproxy/fruit.com_v1.0.0/go.mod -- | ||
>module fruit.com | ||
> | ||
>-- stdout.txt -- | ||
>goodbye | ||
>-- .gomodproxy/fruit.com_v1.0.0/fruit/fruit.go -- | ||
>package fruit | ||
> | ||
>const Apple = "apple" | ||
>-- .gomodproxy/fruit.com_v1.0.0/coretest/coretest.go -- | ||
>// package coretest becomes a candidate for the missing | ||
>// core import in main above | ||
>package coretest | ||
> | ||
>const Mandarin = "mandarin" | ||
-- res.txt -- | ||
>exec printf 'hello\n' | ||
>cmp stdout stdout.txt | ||
> | ||
>-- .gomodproxy/fruit.com_v1.0.0/.mod -- | ||
>module fruit.com | ||
> | ||
>-- .gomodproxy/fruit.com_v1.0.0/.info -- | ||
>{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} | ||
> | ||
>-- .gomodproxy/fruit.com_v1.0.0/go.mod -- | ||
>module fruit.com | ||
> | ||
>-- stdout.txt -- | ||
>hello | ||
>-- .gomodproxy/fruit.com_v1.0.0/fruit/fruit.go -- | ||
>package fruit | ||
> | ||
>const Apple = "apple" | ||
>-- .gomodproxy/fruit.com_v1.0.0/coretest/coretest.go -- | ||
>// package coretest becomes a candidate for the missing | ||
>// core import in main above | ||
>package coretest | ||
> | ||
>const Mandarin = "mandarin" |