Debian Codegraph @

cmd/shfmt/testdata/script/atomic.txtar

raw
1 [windows] skip 'atomic writes aren''t supported on Windows'
2 [!exec:sh] skip 'sh is required to run this test'
3
4 # If we don't do atomic writes, most shells will error when shfmt overwrites the
5 # very script it's running from. This is because the shell doesn't read all of
6 # the input script upfront.
7 exec sh input.sh
8 cmp stdout stdout.golden
9 ! stderr .
10
11 cmp input.sh input.sh.golden
12
13 -- input.sh --
14 echo foo
15 shfmt -l -w input.sh
16 echo bar
17 -- input.sh.golden --
18 echo foo
19 shfmt -l -w input.sh
20 echo bar
21 -- stdout.golden --
22 foo
23 input.sh
24 bar