From 5d6ce25142dd4624f785ebf2ffe4cc2afb8d49e0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sun, 18 Mar 2018 00:33:28 +0300 Subject: Add support for cp builtin -p option --- tests/test/script/builtin/cp-dir/cp-file | 0 tests/test/script/builtin/cp.test | 76 ++++++++++++++++++++++++++++++-- 2 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 tests/test/script/builtin/cp-dir/cp-file (limited to 'tests') diff --git a/tests/test/script/builtin/cp-dir/cp-file b/tests/test/script/builtin/cp-dir/cp-file new file mode 100644 index 0000000..e69de29 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 <"\$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 + } + } +} -- cgit v1.1