blob: 802cfee702352a8b454429d5a1a914fac99b0635 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# file : tests/test/script/builtin/cp.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
.include ../common.testscript
: file
:
: Test synopsis 1: make a file copy at the specified path.
:
{
: cleanup
:
{
: enabled
:
$c <<EOI && $b
touch a;
cp a b
EOI
: disabled
:
$c <<EOI && $b
touch a;
cp --no-cleanup a b;
rm b
EOI
: existing
:
: 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
{
touch a;
cp a ../b
}
EOI
}
}
: dir
:
: Test synopsis 2: make a directory copy at the specified path.
:
{
: cleanup
:
$c <<EOI && $b
mkdir a;
touch a/b;
cp -r a b
EOI
: no-cleanup
:
$c <<EOI && $b
mkdir a;
touch a/b;
cp --no-cleanup -r a b;
rm -r b
EOI
}
: files
:
: Test synopsis 3: copy files into the specified directory.
:
{
: cleanup
:
$c <<EOI && $b
touch a b;
mkdir c;
cp a b c/
EOI
: no-cleanup
:
$c <<EOI && $b
touch a b;
mkdir c;
cp --no-cleanup a b c/;
rm c/a c/b
EOI
}
: filesystem-entries
:
: Test synopsis 4: copy filesystem entries into the specified directory.
:
{
: cleanup
:
$c <<EOI && $b
mkdir a b;
touch c a/c;
cp -R a c b/
EOI
: no-cleanup
:
$c <<EOI && $b
mkdir a b;
touch c a/c;
cp --no-cleanup -R a c b/;
rm -r b/a/ b/c
EOI
}
|