From 0898e65ca37686a0a06a2980acf8cc40c0e2494e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 17 Jul 2018 14:46:18 +0300 Subject: Add --after option for testscript touch builtin --- tests/in/testscript | 4 +--- tests/test/script/builtin/touch.test | 35 +++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 9 deletions(-) (limited to 'tests') 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 @@ $* <'FOO BAR'; -if ($cxx.target.class != 'windows') - sleep 1 -end; cat <'$fox$ $baz$' >=test.in; +touch --after test test.in; $* <=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 <"touch: missing file" == 1' && $b +$c <'touch --no-cleanup 2>"touch: missing file" != 0' && $b : empty-path : : Test touching an empty path. : $c <"touch: invalid path ''" == 1 +touch '' 2>"touch: invalid path ''" != 0 EOI : dir-update @@ -61,5 +61,28 @@ EOI : $c <~"%touch: cannot create/update .+: .+%" == 1 +touch a 2>~'%touch: cannot create/update .+: .+%' != 0 EOI + +: after +: +{ + : success + : + $c <'touch: missing --after option value' != 0 + EOI + + : not-exists + : + $c <~"%touch: cannot obtain file '.+a' modification time: .+%" != 0 + EOI +} -- cgit v1.1