diff options
Diffstat (limited to 'tests/test/script/builtin/cp.test')
-rw-r--r-- | tests/test/script/builtin/cp.test | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/tests/test/script/builtin/cp.test b/tests/test/script/builtin/cp.test index 4709459..6a26e35 100644 --- a/tests/test/script/builtin/cp.test +++ b/tests/test/script/builtin/cp.test @@ -103,9 +103,9 @@ { : existing : - : Test that copy over an existing file doesn't register cleanup. If it does - : then the file would be removed while leaving the embedded scope, and so - : the cleanup registered by the outer touch would fail. + : Test that copy over 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 outer touch would fail. : $c <<EOI && $b +touch b @@ -304,3 +304,73 @@ EOI } } + +: attrs +: +if ($cxx.target.class != 'windows') +{ + fs = 's/.+ (\S+\s+\S+\s+\S+)\s+cp-file/\1/p' + ds = 's/.+ (\S+\s+\S+\s+\S+)\s+cp-dir/\1/p' + + : copy + : + { + : file + : + { + $c <<"EOI" && $b + ls -l $src_base/cp-dir | sed -n -e '$fs' | \ + set t; + + cp -p $src_base/cp-dir/cp-file ./; + ls -l | sed -n -e '$fs' >"\$t" + EOI + } + + : dir + : + { + $c <<"EOI" && $b + ls -l $src_base | sed -n -e '$ds' | \ + set t; + + cp -p -r $src_base/cp-dir ./; + ls -l | sed -n -e '$ds' >"\$t" + EOI + } + } + + : no-copy + : + { + : file + : + { + $c <<"EOI" && $b 2>>~%EOE% != 0 + ls -l $src_base/cp-dir | sed -n -e '$fs' | \ + set t; + + cp $src_base/cp-dir/cp-file ./; + ls -l | sed -n -e '$fs' >"\$t" + EOI + %.+ error: sed stdout doesn't match expected% + %.+ + EOE + } + + : dir + : + { + $c <<"EOI" && $b 2>>~%EOE% != 0 + ls -l $src_base | sed -n -e '$ds' | \ + set t; + + cp -r $src_base/cp-dir ./; + ls -l | sed -n -e '$ds' >"\$t" + EOI + %.+ error: sed stdout doesn't match expected% + %.+ + EOE + } + } +} |