diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-02-17 21:30:20 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-02-17 21:30:20 +0100 |
| commit | 2f4dc99cec1c6fa33257dea91ab3bcd99b1cbdf5 (patch) | |
| tree | eb983e54bac5ae226474bd8c5d6a29006b00ff12 /tests/lang | |
| parent | db1659a987cd240b78e45666617248d3d0cc7d64 (diff) | |
Refresh tests 🌊
Diffstat (limited to 'tests/lang')
32 files changed, 230 insertions, 289 deletions
diff --git a/tests/lang/ref/call-bracket.png b/tests/lang/ref/call-bracket.png Binary files differdeleted file mode 100644 index b5b2f767..00000000 --- a/tests/lang/ref/call-bracket.png +++ /dev/null diff --git a/tests/lang/typ/array.typ b/tests/lang/typ/array.typ index f80cc0cd..b17b722c 100644 --- a/tests/lang/typ/array.typ +++ b/tests/lang/typ/array.typ @@ -19,13 +19,13 @@ , #003 ,)} -// Error: 3-3 expected closing paren +// Error: 3 expected closing paren {(} // Error: 2-3 expected expression, found closing paren {)} -// Error: 2:4-2:4 expected comma +// Error: 2:4 expected comma // Error: 1:4-1:6 expected expression, found end of block comment {(1*/2)} @@ -36,7 +36,7 @@ {(,1)} // Missing expression makes named pair incomplete, making this an empty array. -// Error: 5-5 expected expression +// Error: 5 expected expression {(a:)} // Named pair after this is already identified as an array. diff --git a/tests/lang/typ/block-invalid.typ b/tests/lang/typ/block-invalid.typ index cf51b91b..28874861 100644 --- a/tests/lang/typ/block-invalid.typ +++ b/tests/lang/typ/block-invalid.typ @@ -7,28 +7,28 @@ {1u} // Should output `1`. -// Error: 3-3 expected semicolon or line break +// Error: 3 expected semicolon or line break {0 1} // Should output `2`. -// Error: 2:13-2:13 expected semicolon or line break -// Error: 1:24-1:24 expected semicolon or line break -{#let x = -1 #let y = 3 x + y} +// Error: 2:12 expected semicolon or line break +// Error: 1:22 expected semicolon or line break +{let x = -1 let y = 3 x + y} // Should output `3`. { - // Error: 10-13 expected identifier, found string - #for "v" + // Error: 9-12 expected identifier, found string + for "v" - // Error: 11-11 expected keyword `#in` - #for v #let z = 1 + 2 + // Error: 10 expected keyword `#in` + for v let z = 1 + 2 z } --- // Ref: false -// Error: 3:1-3:1 expected closing brace +// Error: 3:1 expected closing brace { --- diff --git a/tests/lang/typ/block-scoping.typ b/tests/lang/typ/block-scoping.typ index bd1f5867..7bb98969 100644 --- a/tests/lang/typ/block-scoping.typ +++ b/tests/lang/typ/block-scoping.typ @@ -3,17 +3,17 @@ --- // Block in template does not create a scope. -{ #let x = 1 } -#[test x, 1] +{ let x = 1 } +#test(x, 1) --- // Block in expression does create a scope. #let a = { - #let b = 1 + let b = 1 b } -#[test a, 1] +#test(a, 1) // Error: 2-3 unknown variable {b} @@ -21,12 +21,12 @@ --- // Multiple nested scopes. { - #let a = "a1" + let a = "a1" { - #let a = "a2" + let a = "a2" { test(a, "a2") - #let a = "a3" + let a = "a3" test(a, "a3") } test(a, "a2") diff --git a/tests/lang/typ/block-value.typ b/tests/lang/typ/block-value.typ index 62934ce6..4a075c03 100644 --- a/tests/lang/typ/block-value.typ +++ b/tests/lang/typ/block-value.typ @@ -7,7 +7,7 @@ All none {} // Let evaluates to none. -{ #let v = 0 } +{ let v = 0 } // Trailing none evaluates to none. { @@ -20,19 +20,19 @@ All none { "Hello" } // Evaluates to trailing expression. -{ #let x = "Hel"; x + "lo" } +{ let x = "Hel"; x + "lo" } // Evaluates to concatenation of for loop bodies. { - #let parts = ("Hel", "lo") - #for s #in parts [{s}] + let parts = ("Hel", "lo") + for s in parts [{s}] } --- // Works the same way in code environment. // Ref: false -#[test { - #let x = 1 - #let y = 2 +#test(3, { + let x = 1 + let y = 2 x + y -}, 3] +}) diff --git a/tests/lang/typ/call-args.typ b/tests/lang/typ/call-args.typ index cf79c1f0..53ae0b97 100644 --- a/tests/lang/typ/call-args.typ +++ b/tests/lang/typ/call-args.typ @@ -2,33 +2,33 @@ --- // One argument. -#[f bold] +#f(bold) // One argument and trailing comma. -#[f 1,] +#f(1,) // One named argument. -#[f a:2] +#f(a:2) // Mixed arguments. {f(1, a: (3, 4), 2, b: "5")} --- -// Error: 5-6 expected expression, found colon -#[f :] +// Error: 4-5 expected expression, found colon +#f(:) -// Error: 8-10 expected expression, found end of block comment -#[f a:1*/] +// Error: 7-9 expected expression, found end of block comment +#f(a:1*/) -// Error: 6-6 expected comma -#[f 1 2] +// Error: 5 expected comma +#f(1 2) -// Error: 2:5-2:6 expected identifier -// Error: 1:7-1:7 expected expression -#[f 1:] +// Error: 2:4-2:5 expected identifier +// Error: 1:6 expected expression +#f(1:) -// Error: 5-6 expected identifier -#[f 1:2] +// Error: 4-5 expected identifier +#f(1:2) // Error: 4-7 expected identifier {f((x):1)} diff --git a/tests/lang/typ/call-bracket.typ b/tests/lang/typ/call-bracket.typ deleted file mode 100644 index eb097094..00000000 --- a/tests/lang/typ/call-bracket.typ +++ /dev/null @@ -1,48 +0,0 @@ -// Test bracketed function calls. - ---- -// Whitespace is insignificant. -#[ f ] - -// Alternatives for embedding. -#[f f()], #[f #[f]], #[f][#[f]], - -// Tight functions. -#[f]#[f] - -// Multi-paragraph body. -#[align right][ - First - - Second -] - ---- -// Chained once. -#[f | f] - -// Chained twice. -#[f|f|f] - -// With body. -// Error: 7-8 expected identifier, found integer -#[f | 1 | box][💕] - -// With actual functions. -#[box width: 1cm | image "res/rhino.png"] - ---- -// Error: 8-8 expected identifier -#[f 1 |] - -// Error: 4-4 expected identifier -#[ | f true] - -// Error: 2:3-2:3 expected identifier -// Error: 1:4-1:4 expected identifier -#[|][Nope] - -// Pipe wins over parens. -// Error: 2:6-2:6 expected closing paren -// Error: 1:9-1:10 expected expression, found closing paren -#[f (|f )] diff --git a/tests/lang/typ/call-invalid.typ b/tests/lang/typ/call-invalid.typ index 8e3efa32..a04f5959 100644 --- a/tests/lang/typ/call-invalid.typ +++ b/tests/lang/typ/call-invalid.typ @@ -1,36 +1,24 @@ // Test invalid function calls. --- -// Error: 4-4 expected closing paren -{f(} - ---- -// Error: 4:1-4:1 expected identifier -// Error: 3:1-3:1 expected closing bracket -#[ +// Error: 1-2 unexpected invalid token +# --- -// Error: 3-3 expected identifier -#[] - -// Error: 3-6 expected identifier, found string -#["f"] +#let x = "string" -// Error: 2:3-2:4 expected identifier, found opening paren -// Error: 1:5-1:6 expected expression, found closing paren -#[(f)] +// Error: 2-3 expected function, found string +#x() --- -#let x = "string" - -// Error: 3-4 expected function, found string -#[x] +// Error: 3:1 expected closing bracket +#f[`a]` --- -// Error: 3:1-3:1 expected closing bracket -#[f][`a]` +// Error: 4 expected closing paren +{f(} --- -// Error: 3:1-3:1 expected quote -// Error: 2:1-2:1 expected closing bracket -#[f "] +// Error: 3:1 expected quote +// Error: 2:1 expected closing bracket +#f("] diff --git a/tests/lang/typ/call-paren.typ b/tests/lang/typ/call-paren.typ deleted file mode 100644 index 482e20e8..00000000 --- a/tests/lang/typ/call-paren.typ +++ /dev/null @@ -1,11 +0,0 @@ -// Test parenthesized function calls. -// Ref: false - ---- -// Whitespace insignificant. -#[test type(1), "integer"] -#[test type (1), "integer"] - -// From variable. -#let alias = type -#[test alias(alias), "function"] diff --git a/tests/lang/typ/call-value.typ b/tests/lang/typ/call-value.typ new file mode 100644 index 00000000..0e257717 --- /dev/null +++ b/tests/lang/typ/call-value.typ @@ -0,0 +1,14 @@ +// Test function calls. +// Ref: false + +--- +// Whitespace is insignificant. +#test(type(1), "integer") +#test (type (1), "integer") + +// From variable. +#let alias = type +#test(alias(alias), "function") + +// Returns template. +#test(type(font(12pt)), "template") diff --git a/tests/lang/typ/comment.typ b/tests/lang/typ/comment.typ index 8b394f1f..e5892453 100644 --- a/tests/lang/typ/comment.typ +++ b/tests/lang/typ/comment.typ @@ -11,8 +11,8 @@ C/* */D // Works in code. -#[test type /*1*/ (1) // -, "integer"] +#test(type /*1*/ (1) // +, "integer") --- // End should not appear without start. diff --git a/tests/lang/typ/dict.typ b/tests/lang/typ/dict.typ index b12dbd59..076a572f 100644 --- a/tests/lang/typ/dict.typ +++ b/tests/lang/typ/dict.typ @@ -14,7 +14,7 @@ // Identified as dictionary due to initial colon. // Error: 4:4-4:5 expected named pair, found expression -// Error: 3:5-3:5 expected comma +// Error: 3:5 expected comma // Error: 2:12-2:16 expected identifier // Error: 1:17-1:18 expected expression, found colon {(:1 b:[], true::)} diff --git a/tests/lang/typ/escape.typ b/tests/lang/typ/escape.typ index 3c0f02f3..eeac4997 100644 --- a/tests/lang/typ/escape.typ +++ b/tests/lang/typ/escape.typ @@ -26,5 +26,5 @@ \u{FFFFFF} // Unterminated. -// Error: 6-6 expected closing brace +// Error: 6 expected closing brace \u{41*Bold* diff --git a/tests/lang/typ/expr-assoc.typ b/tests/lang/typ/expr-assoc.typ index 64db98c6..19c56951 100644 --- a/tests/lang/typ/expr-assoc.typ +++ b/tests/lang/typ/expr-assoc.typ @@ -3,15 +3,15 @@ --- // Math operators are left-associative. -#[test 10 / 2 / 2 == (10 / 2) / 2, true] -#[test 10 / 2 / 2 == 10 / (2 / 2), false] -#[test 1 / 2 * 3, 1.5] +#test(10 / 2 / 2 == (10 / 2) / 2, true) +#test(10 / 2 / 2 == 10 / (2 / 2), false) +#test(1 / 2 * 3, 1.5) --- // Assignment is right-associative. { - #let x = 1 - #let y = 2 + let x = 1 + let y = 2 x = y = "ok" test(x, none) test(y, "ok") diff --git a/tests/lang/typ/expr-binary.typ b/tests/lang/typ/expr-binary.typ index e84cb282..9fbffe18 100644 --- a/tests/lang/typ/expr-binary.typ +++ b/tests/lang/typ/expr-binary.typ @@ -10,30 +10,30 @@ // Test math operators. // Addition. -#[test 2 + 4, 6] -#[test "a" + "b", "ab"] -#[test (1, 2) + (3, 4), (1, 2, 3, 4)] -#[test (a: 1) + (b: 2, c: 3), (a: 1, b: 2, c: 3)] +#test(2 + 4, 6) +#test("a" + "b", "ab") +#test((1, 2) + (3, 4), (1, 2, 3, 4)) +#test((a: 1) + (b: 2, c: 3), (a: 1, b: 2, c: 3)) // Subtraction. -#[test 1-4, 3*-1] -#[test 4cm - 2cm, 2cm] -#[test 1e+2-1e-2, 99.99] +#test(1-4, 3*-1) +#test(4cm - 2cm, 2cm) +#test(1e+2-1e-2, 99.99) // Multiplication. -#[test 2 * 4, 8] +#test(2 * 4, 8) // Division. -#[test 12pt/.4, 30pt] -#[test 7 / 2, 3.5] +#test(12pt/.4, 30pt) +#test(7 / 2, 3.5) // Combination. -#[test 3-4 * 5 < -10, true] -#[test { #let x; x = 1 + 4*5 >= 21 and { x = "a"; x + "b" == "ab" }; x }, true] +#test(3-4 * 5 < -10, true) +#test({ let x; x = 1 + 4*5 >= 21 and { x = "a"; x + "b" == "ab" }; x }, true) // Mathematical identities. #let nums = (1, 3.14, 12pt, 45deg, 90%, 13% + 10pt) -#for v #in nums { +#for v in nums { // Test plus and minus. test(v + v - v, v) test(v - v - v, -v) @@ -43,12 +43,12 @@ test(v + v, 2 * v) // Integer addition does not give a float. - #if type(v) != "integer" { + if type(v) != "integer" { test(v + v, 2.0 * v) } // Linears cannot be divided by themselves. - #if type(v) != "linear" { + if type(v) != "linear" { test(v / v, 1.0) test(v / v == 1, true) } @@ -59,12 +59,12 @@ // - multiplied with integers and floats, // - divided by floats. #let dims = (10pt, 30%, 50% + 3cm) -#for a #in dims { - #for b #in dims { +#for a in dims { + for b in dims { test(type(a + b), type(a - b)) } - #for b #in (7, 3.14) { + for b in (7, 3.14) { test(type(a * b), type(a)) test(type(b * a), type(a)) test(type(a / b), type(a)) @@ -75,57 +75,57 @@ // Test boolean operators. // And. -#[test false and false, false] -#[test false and true, false] -#[test true and false, false] -#[test true and true, true] +#test(false and false, false) +#test(false and true, false) +#test(true and false, false) +#test(true and true, true) // Or. -#[test false or false, false] -#[test false or true, true] -#[test true or false, true] -#[test true or true, true] +#test(false or false, false) +#test(false or true, true) +#test(true or false, true) +#test(true or true, true) // Short-circuiting. -#[test false and dont-care, false] -#[test true or dont-care, true] +#test(false and dont-care, false) +#test(true or dont-care, true) --- // Test equality operators. -#[test 1 == "hi", false] -#[test 1 == 1.0, true] -#[test 30% == 30% + 0cm, true] -#[test 1in == 0% + 72pt, true] -#[test 30% == 30% + 1cm, false] -#[test "ab" == "a" + "b", true] -#[test () == (1,), false] -#[test (1, 2, 3) == (1, 2.0) + (3,), true] -#[test (:) == (a: 1), false] -#[test (a: 2 - 1.0, b: 2) == (b: 2, a: 1), true] -#[test [*Hi*] == [*Hi*], true] - -#[test "a" != "a", false] -#[test [*] != [_], true] +#test(1 == "hi", false) +#test(1 == 1.0, true) +#test(30% == 30% + 0cm, true) +#test(1in == 0% + 72pt, true) +#test(30% == 30% + 1cm, false) +#test("ab" == "a" + "b", true) +#test(() == (1,), false) +#test((1, 2, 3) == (1, 2.0) + (3,), true) +#test((:) == (a: 1), false) +#test((a: 2 - 1.0, b: 2) == (b: 2, a: 1), true) +#test([*Hi*] == [*Hi*], true) + +#test("a" != "a", false) +#test([*] != [_], true) --- // Test comparison operators. -#[test 13 * 3 < 14 * 4, true] -#[test 5 < 10, true] -#[test 5 > 5, false] -#[test 5 <= 5, true] -#[test 5 <= 4, false] -#[test 45deg < 1rad, true] +#test(13 * 3 < 14 * 4, true) +#test(5 < 10, true) +#test(5 > 5, false) +#test(5 <= 5, true) +#test(5 <= 4, false) +#test(45deg < 1rad, true) --- // Test assignment operators. #let x = 0 -{ x = 10 } #[test x, 10] -{ x -= 5 } #[test x, 5] -{ x += 1 } #[test x, 6] -{ x *= x } #[test x, 36] -{ x /= 2.0 } #[test x, 18.0] -{ x = "some" } #[test x, "some"] -{ x += "thing" } #[test x, "something"] +{ x = 10 } #test(x, 10) +{ x -= 5 } #test(x, 5) +{ x += 1 } #test(x, 6) +{ x *= x } #test(x, 36) +{ x /= 2.0 } #test(x, 18.0) +{ x = "some" } #test(x, "some") +{ x += "thing" } #test(x, "something") diff --git a/tests/lang/typ/expr-invalid.typ b/tests/lang/typ/expr-invalid.typ index 2d16034b..329a2616 100644 --- a/tests/lang/typ/expr-invalid.typ +++ b/tests/lang/typ/expr-invalid.typ @@ -4,14 +4,14 @@ --- // Missing expressions. -// Error: 3-3 expected expression +// Error: 3 expected expression {-} -// Error: 11-11 expected expression -#[test {1+}, 1] +// Error: 10 expected expression +#test({1+}, 1) -// Error: 11-11 expected expression -#[test {2*}, 2] +// Error: 10 expected expression +#test({2*}, 2) --- // Mismatched types. @@ -36,7 +36,7 @@ {(1 + "2", 40% - 1, 2 * true, 3 / 12pt)} // Error: 15-23 cannot apply '+=' to integer and string -{ #let x = 1; x += "2" } +{ let x = 1; x += "2" } --- // Bad left-hand sides of assignment. diff --git a/tests/lang/typ/expr-prec.typ b/tests/lang/typ/expr-prec.typ index fea5f794..738e8fdf 100644 --- a/tests/lang/typ/expr-prec.typ +++ b/tests/lang/typ/expr-prec.typ @@ -3,14 +3,14 @@ --- // Multiplication binds stronger than addition. -#[test 1+2*-3, -5] +#test(1+2*-3, -5) // Subtraction binds stronger than comparison. -#[test 3 == 5 - 2, true] +#test(3 == 5 - 2, true) // Boolean operations bind stronger than '=='. -#[test "a" == "a" and 2 < 3, true] -#[test not "b" == "b", false] +#test("a" == "a" and 2 < 3, true) +#test(not "b" == "b", false) // Assignment binds stronger than boolean operations. // Error: 2-7 cannot assign to this expression @@ -18,11 +18,11 @@ --- // Parentheses override precedence. -#[test (1), 1] -#[test (1+2)*-3, -9] +#test((1), 1) +#test((1+2)*-3, -9) -// Error: 15-15 expected closing paren -#[test {(1 + 1}, 2] +// Error: 15 expected closing paren +#test({(1 + 1}, 2) --- // Precedence doesn't matter for chained unary operators. diff --git a/tests/lang/typ/expr-unary.typ b/tests/lang/typ/expr-unary.typ index a1d97a49..c4b1937d 100644 --- a/tests/lang/typ/expr-unary.typ +++ b/tests/lang/typ/expr-unary.typ @@ -3,7 +3,7 @@ --- // Test plus and minus. -#for v #in (1, 3.14, 12pt, 45deg, 90%, 13% + 10pt) { +#for v in (1, 3.14, 12pt, 45deg, 90%, 13% + 10pt) { // Test plus. test(+v, v) @@ -15,9 +15,9 @@ test(-++ --v, -v) } -#[test -(4 + 2), 6-12] +#test(-(4 + 2), 6-12) --- // Test not. -#[test not true, false] -#[test not false, true] +#test(not true, false) +#test(not false, true) diff --git a/tests/lang/typ/for-invalid.typ b/tests/lang/typ/for-invalid.typ index ca83649a..3866909f 100644 --- a/tests/lang/typ/for-invalid.typ +++ b/tests/lang/typ/for-invalid.typ @@ -7,29 +7,26 @@ // Error: 7-7 expected keyword `#in` #for v -// Error: 11-11 expected expression -#for v #in +// Error: 10-10 expected expression +#for v in -// Error: 16-16 expected body -#for v #in iter +// Error: 15-15 expected body +#for v in iter --- -// Should output `v iter`. -// Error: 2:5-2:5 expected identifier -// Error: 2:3-2:6 unexpected keyword `#in` +// Should output `v in iter`. +// Error: 5 expected identifier #for -v #in iter {} +v in iter {} // Should output `A thing`. // Error: 7-10 expected identifier, found string A#for "v" thing. -// Should output `iter`. -// Error: 2:6-2:9 expected identifier, found string -// Error: 1:10-1:13 unexpected keyword `#in` -#for "v" #in iter {} +// Should output `in iter`. +// Error: 6-9 expected identifier, found string +#for "v" in iter {} -// Should output `+ b iter`. -// Error: 2:7-2:7 expected keyword `#in` -// Error: 1:12-1:15 unexpected keyword `#in` -#for a + b #in iter {} +// Should output `+ b in iter`. +// Error: 7 expected keyword `#in` +#for a + b in iter {} diff --git a/tests/lang/typ/for-loop.typ b/tests/lang/typ/for-loop.typ index 2af7ab04..e38ed190 100644 --- a/tests/lang/typ/for-loop.typ +++ b/tests/lang/typ/for-loop.typ @@ -4,28 +4,29 @@ --- // Array. -#for x #in () {} +#for x in () {} #let sum = 0 -#for x #in (1, 2, 3, 4, 5) { +#for x in (1, 2, 3, 4, 5) { sum += x } -#[test sum, 15] + +#test(sum, 15) --- // Dictionary. // Ref: true -(\ #for k, v #in (name: "Typst", age: 2) [ - #[h 0.5cm] {k}: {v}, \ +(\ #for k, v in (name: "Typst", age: 2) [ + #h(0.5cm) {k}: {v}, \ ]) --- // String. { - #let out = "" - #let first = true - #for c #in "abc" { - #if not first { + let out = "" + let first = true + for c in "abc" { + if not first { out += ", " } first = false @@ -36,16 +37,16 @@ --- // Uniterable expression. -// Error: 12-16 cannot loop over boolean -#for v #in true {} +// Error: 11-15 cannot loop over boolean +#for v in true {} // Make sure that we don't complain twice. -// Error: 12-19 cannot add integer and string -#for v #in 1 + "2" {} +// Error: 11-18 cannot add integer and string +#for v in 1 + "2" {} // Error: 14-17 cannot apply '-' to string #let error = -"" -#let result = #for v #in (1, 2, 3) { - #if v < 2 [Ok] #else {error} +#let result = for v in (1, 2, 3) { + if v < 2 [Ok] else {error} } -#[test result, error] +#test(result, error) diff --git a/tests/lang/typ/for-pattern.typ b/tests/lang/typ/for-pattern.typ index 87bf603f..38253b33 100644 --- a/tests/lang/typ/for-pattern.typ +++ b/tests/lang/typ/for-pattern.typ @@ -5,26 +5,26 @@ #let out = () // Values of array. -#for v #in (1, 2, 3) { +#for v in (1, 2, 3) { out += (v,) } // Values of dictionary. -#for v #in (a: 4, b: 5) { +#for v in (a: 4, b: 5) { out += (v,) } // Keys and values of dictionary. -#for k, v #in (a: 6, b: 7) { +#for k, v in (a: 6, b: 7) { out += (k,) out += (v,) } -#[test out, (1, 2, 3, 4, 5, "a", 6, "b", 7)] +#test(out, (1, 2, 3, 4, 5, "a", 6, "b", 7)) --- // Keys and values of array. // Error: 6-10 mismatched pattern -#for k, v #in (-1, -2, -3) { +#for k, v in (-1, -2, -3) { dont-care } diff --git a/tests/lang/typ/for-value.typ b/tests/lang/typ/for-value.typ index 1813787d..3ab80716 100644 --- a/tests/lang/typ/for-value.typ +++ b/tests/lang/typ/for-value.typ @@ -3,18 +3,18 @@ --- // Template body yields template. // Should output `234`. -#for v #in (1, 2, 3, 4) [#if v >= 2 [{v}]] +#for v in (1, 2, 3, 4) [#if v >= 2 [{v}]] --- // Block body yields template. // Should output `[1st, 2nd, 3rd, 4th, 5th, 6th]`. { - "[" + #for v #in (1, 2, 3, 4, 5, 6) { - (#if v > 1 [, ] + "[" + for v in (1, 2, 3, 4, 5, 6) { + (if v > 1 [, ] + [{v}] - + #if v == 1 [st] - + #if v == 2 [nd] - + #if v == 3 [rd] - + #if v >= 4 [th]) + + if v == 1 [st] + + if v == 2 [nd] + + if v == 3 [rd] + + if v >= 4 [th]) } + "]" } diff --git a/tests/lang/typ/heading.typ b/tests/lang/typ/heading.typ index 9bff2e6e..8497ec8f 100644 --- a/tests/lang/typ/heading.typ +++ b/tests/lang/typ/heading.typ @@ -9,7 +9,7 @@ ======6 // Too many hashtags. -// Warning: 1:1-1:8 should not exceed depth 6 +// Warning: 1-8 should not exceed depth 6 =======7 --- @@ -21,7 +21,7 @@ } // Function call continues heading. -= #[box][ += #box[ A ] B @@ -35,7 +35,7 @@ B // Parsed as headings if at start of the context. /**/ = Ok {[== Ok]} -#[box][=== Ok] +#box[=== Ok] // Not at the start of the context. No = heading diff --git a/tests/lang/typ/if-branch.typ b/tests/lang/typ/if-branch.typ index 8399d674..64523a63 100644 --- a/tests/lang/typ/if-branch.typ +++ b/tests/lang/typ/if-branch.typ @@ -30,7 +30,7 @@ #if false [ Bad. ] #else { - #let pt = "." + let pt = "." "Ok" + pt } diff --git a/tests/lang/typ/if-invalid.typ b/tests/lang/typ/if-invalid.typ index c7ead226..166de122 100644 --- a/tests/lang/typ/if-invalid.typ +++ b/tests/lang/typ/if-invalid.typ @@ -1,13 +1,13 @@ // Test invalid if syntax. --- -// Error: 4-4 expected expression +// Error: 4 expected expression #if -// Error: 5-5 expected expression -{#if} +// Error: 4 expected expression +{if} -// Error: 6-6 expected body +// Error: 6 expected body #if x // Error: 1-6 unexpected keyword `#else` @@ -15,14 +15,14 @@ --- // Should output `x`. -// Error: 4-4 expected expression +// Error: 4 expected expression #if x {} // Should output `something`. -// Error: 6-6 expected body +// Error: 6 expected body #if x something // Should output `A thing.` -// Error: 20-20 expected body +// Error: 20 expected body A#if false {} #else thing diff --git a/tests/lang/typ/if-value.typ b/tests/lang/typ/if-value.typ index f9e95ff6..d7124255 100644 --- a/tests/lang/typ/if-value.typ +++ b/tests/lang/typ/if-value.typ @@ -3,19 +3,19 @@ --- { - #let x = 1 - #let y = 2 - #let z + let x = 1 + let y = 2 + let z // Returns if branch. - z = #if x < y { "ok" } + z = if x < y { "ok" } test(z, "ok") // Returns else branch. - z = #if x > y { "bad" } #else { "ok" } + z = if x > y { "bad" } else { "ok" } test(z, "ok") // Missing else evaluates to none. - z = #if x > y { "bad" } + z = if x > y { "bad" } test(z, none) } diff --git a/tests/lang/typ/let-invalid.typ b/tests/lang/typ/let-invalid.typ index 3e32e2cf..f29353ed 100644 --- a/tests/lang/typ/let-invalid.typ +++ b/tests/lang/typ/let-invalid.typ @@ -1,17 +1,17 @@ // Test invalid let binding syntax. --- -// Error: 5-5 expected identifier +// Error: 5 expected identifier #let // Error: 6-9 expected identifier, found string #let "v" // Should output `1`. -// Error: 7-7 expected semicolon or line break +// Error: 7 expected semicolon or line break #let v 1 -// Error: 9-9 expected expression +// Error: 9 expected expression #let v = --- diff --git a/tests/lang/typ/let-terminated.typ b/tests/lang/typ/let-terminated.typ index 6dda7bb2..623265e0 100644 --- a/tests/lang/typ/let-terminated.typ +++ b/tests/lang/typ/let-terminated.typ @@ -13,16 +13,16 @@ One Three // Terminated because expression ends. -// Error: 12-12 expected semicolon or line break +// Error: 12 expected semicolon or line break #let v4 = 4 Four // Terminated by semicolon even though we are in a paren group. -// Error: 2:19-2:19 expected expression -// Error: 1:19-1:19 expected closing paren +// Error: 2:19 expected expression +// Error: 1:19 expected closing paren #let v5 = (1, 2 + ; Five -#[test v1, 1] -#[test v2, 2] -#[test v3, 3] -#[test v4, 4] -#[test v5, (1, 2)] +#test(v1, 1) +#test(v2, 2) +#test(v3, 3) +#test(v4, 4) +#test(v5, (1, 2)) diff --git a/tests/lang/typ/let-value.typ b/tests/lang/typ/let-value.typ index 12e1ba78..700d337d 100644 --- a/tests/lang/typ/let-value.typ +++ b/tests/lang/typ/let-value.typ @@ -4,8 +4,8 @@ --- // Automatically initialized with none. #let x -#[test x, none] +#test(x, none) // Manually initialized with one. #let x = 1 -#[test x, 1] +#test(x, 1) diff --git a/tests/lang/typ/raw.typ b/tests/lang/typ/raw.typ index a783216e..f5074c8e 100644 --- a/tests/lang/typ/raw.typ +++ b/tests/lang/typ/raw.typ @@ -47,5 +47,5 @@ def hi(): --- // Unterminated. -// Error: 2:1-2:1 expected backtick(s) +// Error: 2:1 expected backtick(s) `endless diff --git a/tests/lang/typ/spacing.typ b/tests/lang/typ/spacing.typ index 54e49f2d..d44cd84c 100644 --- a/tests/lang/typ/spacing.typ +++ b/tests/lang/typ/spacing.typ @@ -3,11 +3,11 @@ --- // Spacing around let. -// Error: 6-6 expected identifier +// Error: 6 expected identifier A#let;B \ -A#let x = 1;B #[test x, 1] \ -A #let x = 2;B #[test x, 2] \ -A#let x = 3; B #[test x, 3] \ +A#let x = 1;B #test(x, 1) \ +A #let x = 2;B #test(x, 2) \ +A#let x = 3; B #test(x, 3) \ --- // Spacing around if-else. @@ -22,6 +22,6 @@ A#if true [B] #else [] C \ --- // Spacing around for loop. -A#for _ #in (none,) [B]C \ -A#for _ #in (none,) [B] C \ -A #for _ #in (none,) [B]C \ +A#for _ in (none,) [B]C \ +A#for _ in (none,) [B] C \ +A #for _ in (none,) [B]C \ diff --git a/tests/lang/typ/strong.typ b/tests/lang/typ/strong.typ index 63e6eb35..b02a55a5 100644 --- a/tests/lang/typ/strong.typ +++ b/tests/lang/typ/strong.typ @@ -8,7 +8,7 @@ Partly str*ength*ened. // Scoped to body. -#[box][*Scoped] to body. +#box[*Scoped] to body. // Unterminated is fine. *The End |
