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
|
use super::*;
#[test]
fn mismatched_delimiter() {
Test::new()
.justfile("(]")
.stderr(
"
error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?)
——▶ justfile:1:2
│
1 │ (]
│ ^
",
)
.status(EXIT_FAILURE)
.run();
}
#[test]
fn unexpected_delimiter() {
Test::new()
.justfile("]")
.stderr(
"
error: Unexpected closing delimiter `]`
——▶ justfile:1:1
│
1 │ ]
│ ^
",
)
.status(EXIT_FAILURE)
.run();
}
#[test]
fn paren_continuation() {
Test::new()
.justfile(
"
x := (
'a'
+
'b'
)
foo:
echo {{x}}
",
)
.stdout("ab\n")
.stderr("echo ab\n")
.run();
}
#[test]
fn brace_continuation() {
Test::new()
.justfile(
"
x := if '' == '' {
'a'
} else {
'b'
}
foo:
echo {{x}}
",
)
.stdout("a\n")
.stderr("echo a\n")
.run();
}
#[test]
fn bracket_continuation() {
Test::new()
.justfile(
"
set shell := [
'sh',
'-cu',
]
foo:
echo foo
",
)
.stdout("foo\n")
.stderr("echo foo\n")
.run();
}
#[test]
fn dependency_continuation() {
Test::new()
.justfile(
"
foo: (
bar 'bar'
)
echo foo
bar x:
echo {{x}}
",
)
.stdout("bar\nfoo\n")
.stderr("echo bar\necho foo\n")
.run();
}
#[test]
fn no_interpolation_continuation() {
Test::new()
.justfile(
"
foo:
echo {{ (
'a' + 'b')}}
",
)
.stderr(
"
error: Unterminated interpolation
——▶ justfile:2:8
│
2 │ echo {{ (
│ ^^
",
)
.status(EXIT_FAILURE)
.run();
}
|