aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-03-18 00:33:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-03-19 16:13:40 +0300
commit5d6ce25142dd4624f785ebf2ffe4cc2afb8d49e0 (patch)
tree47769c7b671d0b93a0ae96c103944da3fcdb62b6 /tests
parent91e6f8b321fb470cfffa578dcd7f24669186604f (diff)
Add support for cp builtin -p option
Diffstat (limited to 'tests')
-rw-r--r--tests/test/script/builtin/cp-dir/cp-file0
-rw-r--r--tests/test/script/builtin/cp.test76
2 files changed, 73 insertions, 3 deletions
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
--- /dev/null
+++ b/tests/test/script/builtin/cp-dir/cp-file
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
+ }
+ }
+}