-
Notifications
You must be signed in to change notification settings - Fork 476
/
delimiters.rs
107 lines (96 loc) · 1.47 KB
/
delimiters.rs
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
use super::*;
test! {
name: mismatched_delimiter,
justfile: "(]",
stderr: "
error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?)
——▶ justfile:1:2
│
1 │ (]
│ ^
",
status: EXIT_FAILURE,
}
test! {
name: unexpected_delimiter,
justfile: "]",
stderr: "
error: Unexpected closing delimiter `]`
——▶ justfile:1:1
│
1 │ ]
│ ^
",
status: EXIT_FAILURE,
}
test! {
name: paren_continuation,
justfile: "
x := (
'a'
+
'b'
)
foo:
echo {{x}}
",
stdout: "ab\n",
stderr: "echo ab\n",
}
test! {
name: brace_continuation,
justfile: "
x := if '' == '' {
'a'
} else {
'b'
}
foo:
echo {{x}}
",
stdout: "a\n",
stderr: "echo a\n",
}
test! {
name: bracket_continuation,
justfile: "
set shell := [
'sh',
'-cu',
]
foo:
echo foo
",
stdout: "foo\n",
stderr: "echo foo\n",
}
test! {
name: dependency_continuation,
justfile: "
foo: (
bar 'bar'
)
echo foo
bar x:
echo {{x}}
",
stdout: "bar\nfoo\n",
stderr: "echo bar\necho foo\n",
}
test! {
name: no_interpolation_continuation,
justfile: "
foo:
echo {{ (
'a' + 'b')}}
",
stdout: "",
stderr: "
error: Unterminated interpolation
——▶ justfile:2:8
│
2 │ echo {{ (
│ ^^
",
status: EXIT_FAILURE,
}