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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# file : tests/function/filesystem/testscript
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
.include ../../common.testscript
: path-search
:
{
+mkdir -p a/b
: pattern-path
:
: Test overloads for pattern being of the path type.
:
{
: start-abs-dir
:
$* <'print $path_search([path] "b**/", [dir_path] $src_base/../../a)' >/'b/'
: start-relative-dir
:
$* <'print $path_search([path] "b**/", [dir_path] ../../a)' 2>>~%EOE% != 0
%error: start directory '.+' is relative%
% info: pattern '.+' is relative%
EOE
: start-untyped
:
$* <'print $path_search([path] "b**/", $src_base/../../a)' >/'b/'
: start-multiple-names
:
$* <'print $path_search([path] "b**/", a b)' 2>>EOE != 0
error: invalid argument: invalid dir_path value: multiple names
EOE
}
: pattern-untyped
:
: Test overloads for pattern being untyped.
:
{
: start-dir
:
$* <'print $path_search("b**/", [dir_path] $src_base/../../a)' >/'b/'
: start-untyped
:
$* <'print $path_search("b**/", $src_base/../../a)' >/'b/'
: abs-pattern
:
if ($test.target == $build.host)
{
touch b;
$* <'print $path_search("$src_base/b*")' >>/"EOO"
$out_base/test/$@/b
EOO
}
}
: pattern-multiple-names
:
{
: dir
:
touch b;
$* <'print $path_search(a b, $src_base)' 2>>EOE != 0
error: invalid argument: invalid path value: multiple names
EOE
}
}
: path-match
:
{
: string
:
: Test overloads for at least one of the first two arguments being of the
: string type.
:
{
: string-string
:
$* <'print $path_match([string] "b*", [string] "b")' >'true'
: string-untyped
:
$* <'print $path_match([string] "b*", "b")' >'true'
: untyped-string
:
$* <'print $path_match("b*", [string] "b")' >'true'
: string-path
:
$* <'print $path_match([string] "b*", [path] "b")' >'true'
}
: path
:
: Test overloads for at least one of the first two arguments being of the
: path type.
:
{
: path-path
:
$* <'print $path_match([path] "b**", [path] "a/b")' >'true'
: path-path-untyped
:
$* <'print $path_match([path] "b**", [path] "a/b", "$src_base")' >'true'
: path-untyped
:
$* <'print $path_match([path] "b**", "a/b")' >'true'
: path-untyped-dir
:
$* <'print $path_match([path] "b**", "a/b", $src_base)' >'true'
: untyped-path
:
$* <'print $path_match("b**", [path] "a/b")' >'true'
}
: untyped
:
: Test overloads for the first two arguments being untyped.
:
{
: converted-to-strings
:
$* <'print $path_match("b**", "b")' >'true'
: converted-to-paths-due-to
{
: pattern
:
$* <'print $path_match("b**/", "a/b/")' >'true'
: entry
:
$* <'print $path_match("b**", "a/b")' >'true'
: start-dir
:
$* <'print $path_match("s***/", "", "$src_base")' >'true'
}
}
}
|