blob: d625a2ceffd7558331e39d82c380af2939c3602c (
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
114
115
|
# file : tests/name/cross.testscript
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
.include ../common.testscript
+cat <<EOI >=build/root.build
define foo: file
define bar: file
foo{*}: extension = foo
bar{*}: extension = bar
EOI
: separation
:
{
$* <'print fox/ {bar baz}' >'fox/ bar baz' : dir
$* <'print foo {bar baz}' >'foo bar baz' : type
$* <'print fox/foo {bar baz}' >'fox/foo bar baz' : dir-type
}
: type
:
{
$* <'print {}{bar}' >'bar'
$* <'print {foo}{}' >'foo{}'
$* <'print {foo}{bar}' >'foo{bar}'
$* <'print {foo}{bar baz}' >'foo{bar} foo{baz}'
$* <'print {foo fox}{bar}' >'foo{bar} fox{bar}'
$* <'print {foo fox}{bar baz}' >'foo{bar} foo{baz} fox{bar} fox{baz}'
}
: dir
:
{
$* <'print dir/{}{bar}' >'dir/bar'
$* <'print dir/{foo}{}' >'foo{dir/}'
$* <'print dir/{foo}{bar}' >'dir/foo{bar}'
$* <'print dir/{foo}{bar baz}' >'dir/foo{bar} dir/foo{baz}'
$* <'print dir/{foo fox}{bar}' >'dir/foo{bar} dir/fox{bar}'
$* <'print dir/{foo fox}{bar baz}' >'dir/foo{bar} dir/foo{baz} dir/fox{bar} dir/fox{baz}'
$* <'print {dir/}{bar}' >'dir/bar'
$* <'print {dir/}{bar baz}' >'dir/bar dir/baz'
$* <'print {dir/ dor/}{bar}' >'dir/bar dor/bar'
$* <'print {dir/ dor/}{bar baz}' >'dir/bar dir/baz dor/bar dor/baz'
}
: dir-type
:
{
$* <'print {dir/foo}{bar}' >'dir/foo{bar}'
$* <'print {dir/foo}{bar baz}' >'dir/foo{bar} dir/foo{baz}'
$* <'print {dir/foo dor/fox}{bar}' >'dir/foo{bar} dor/fox{bar}'
$* <'print {dir/foo dor/fox}{bar baz}' >'dir/foo{bar} dir/foo{baz} dor/fox{bar} dor/fox{baz}'
$* <'print {dir/}{foo}{bar}' >'dir/foo{bar}'
$* <'print {dir/}{foo}{bar baz}' >'dir/foo{bar} dir/foo{baz}'
$* <'print {dir/ dor/}{foo}{bar}' >'dir/foo{bar} dor/foo{bar}'
$* <'print {dir/ dor/}{foo fox}{bar baz}' >'dir/foo{bar} dir/foo{baz} dir/fox{bar} dir/fox{baz} dor/foo{bar} dor/foo{baz} dor/fox{bar} dor/fox{baz}'
}
: proj
:
{
$* <'print {prj%foo}{bar baz}' >'prj%foo{bar} prj%foo{baz}'
$* <'print {foo}{bar prj%baz}' >'foo{bar} prj%foo{baz}'
$* <'print {prj%foo}{bar prk%baz}' 2>>EOE != 0
<stdin>:1:21: error: nested project name prk
EOE
}
: merge
:
{
$* <'print {foo}{bar dir/{baz}}' >'foo{bar} dir/foo{baz}'
$* <'print dir/{foo}{bar dor/{baz}}' >'dir/foo{bar} dir/dor/foo{baz}'
$* <'print {dir/foo{}}{bar}' >'dir/foo{bar}'
$* <'print {dir/{foo}}{bar}' >'dir/foo{bar}'
$* <'print {dir/}{foo{bar}}' >'dir/foo{bar}'
$* <'print {dir/foo{fox}}{bar}' 2>>EOE != 0
<stdin>:1:22: error: nested type name fox
EOE
$* <'print {dir/foo}{fox{bar}}' 2>>EOE != 0
<stdin>:1:20: error: nested type name fox
EOE
}
: pair
:
{
$* <'print x@{dir/ dor/}{foo fox}{bar baz}' >'x@dir/foo{bar} x@dir/foo{baz} x@dir/fox{bar} x@dir/fox{baz} x@dor/foo{bar} x@dor/foo{baz} x@dor/fox{bar} x@dor/fox{baz}'
}
: pattern
:
{
touch x.foo y.bar;
$* <'print {foo bar}{*}' >'foo{x} bar{y}'
mkdir dir && touch dir/x.foo;
$* <'print {*/}{*.foo}' >/'dir/x.foo'
mkdir dir && touch dir/x.foo;
$* <'print {*/}{foo}{*}' >/'dir/foo{x}'
}
# @@ TODO: nested replay.
#
#file{foo} file{bar}: x = {foo fox}{bar baz}
|