diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-07-17 14:46:18 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-07-17 14:47:25 +0300 |
commit | 0898e65ca37686a0a06a2980acf8cc40c0e2494e (patch) | |
tree | e575f1c87bd9d3bb8dde1198389b8bd9f7b697fc /tests | |
parent | fe6f3ec0868185511f5acefb2729eb879798f052 (diff) |
Add --after <ref-file> option for testscript touch builtin
Diffstat (limited to 'tests')
-rw-r--r-- | tests/in/testscript | 4 | ||||
-rw-r--r-- | tests/test/script/builtin/touch.test | 35 |
2 files changed, 30 insertions, 9 deletions
diff --git a/tests/in/testscript b/tests/in/testscript index fe299d7..3e06137 100644 --- a/tests/in/testscript +++ b/tests/in/testscript @@ -62,10 +62,8 @@ $* <<EOI; file{test}: in{test} EOI cat test >'FOO BAR'; -if ($cxx.target.class != 'windows') - sleep 1 -end; cat <'$fox$ $baz$' >=test.in; +touch --after test test.in; $* <<EOI; fox = fox baz = baz diff --git a/tests/test/script/builtin/touch.test b/tests/test/script/builtin/touch.test index 7188a21..04391bd 100644 --- a/tests/test/script/builtin/touch.test +++ b/tests/test/script/builtin/touch.test @@ -22,14 +22,14 @@ EOI : Test that existing file touch doesn't fail. : $c <<EOI && $b -cat <"" >=a; +cat <'' >=a; touch a EOI : no-cleanup : -: Test that touches an existing file doesn't register cleanup. If it does then -: the file would be removed while leaving the embedded scope, and so the +: Test that touching an existing file does not register cleanup. If it does +: then the file would be removed while leaving the embedded scope, and so the : cleanup registered by the first touch would fail. : $c <<EOI && $b @@ -45,14 +45,14 @@ EOI : : Test passing no arguments. : -$c <'touch 2>"touch: missing file" == 1' && $b +$c <'touch --no-cleanup 2>"touch: missing file" != 0' && $b : empty-path : : Test touching an empty path. : $c <<EOI && $b -touch '' 2>"touch: invalid path ''" == 1 +touch '' 2>"touch: invalid path ''" != 0 EOI : dir-update @@ -61,5 +61,28 @@ EOI : $c <<EOI && $b mkdir a; -touch a 2>~"%touch: cannot create/update .+: .+%" == 1 +touch a 2>~'%touch: cannot create/update .+: .+%' != 0 EOI + +: after +: +{ + : success + : + $c <<EOI && $b + touch a; + touch --after a b + EOI + + : no-value + : + $c <<EOI && $b + touch --after 2>'touch: missing --after option value' != 0 + EOI + + : not-exists + : + $c <<EOI && $b + touch --after a b 2>~"%touch: cannot obtain file '.+a' modification time: .+%" != 0 + EOI +} |