summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-01-20 14:05:17 +0100
committerLaurenz <laurmaedje@gmail.com>2023-01-20 14:05:35 +0100
commitdd331f007cb9c9968605f8d3eaef8fb498c21322 (patch)
treef1b1490758ec53fd204724a325158d16c980d131 /tests
parent40561e57fbbc68becac07acd54a34f94f591f277 (diff)
Rewrite parser
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/basics/heading.pngbin24767 -> 24759 bytes
-rw-r--r--tests/ref/basics/list.pngbin20656 -> 20300 bytes
-rw-r--r--tests/typ/basics/list.typ1
-rw-r--r--tests/typ/compiler/array.typ5
-rw-r--r--tests/typ/compiler/block.typ4
-rw-r--r--tests/typ/compiler/call.typ6
-rw-r--r--tests/typ/compiler/closure.typ10
-rw-r--r--tests/typ/compiler/dict.typ11
-rw-r--r--tests/typ/compiler/field.typ3
-rw-r--r--tests/typ/compiler/for.typ9
-rw-r--r--tests/typ/compiler/if.typ6
-rw-r--r--tests/typ/compiler/import.typ20
-rw-r--r--tests/typ/compiler/let.typ8
-rw-r--r--tests/typ/compiler/spread.typ2
-rw-r--r--tests/typ/compiler/while.typ4
-rw-r--r--tests/typ/text/emphasis.typ6
-rw-r--r--tests/typ/text/raw.typ3
17 files changed, 59 insertions, 39 deletions
diff --git a/tests/ref/basics/heading.png b/tests/ref/basics/heading.png
index 96ffcb80..9cb4d098 100644
--- a/tests/ref/basics/heading.png
+++ b/tests/ref/basics/heading.png
Binary files differ
diff --git a/tests/ref/basics/list.png b/tests/ref/basics/list.png
index 5d0f03c0..b6b8ed3e 100644
--- a/tests/ref/basics/list.png
+++ b/tests/ref/basics/list.png
Binary files differ
diff --git a/tests/typ/basics/list.typ b/tests/typ/basics/list.typ
index fc3e5ca7..b8bd59ea 100644
--- a/tests/typ/basics/list.typ
+++ b/tests/typ/basics/list.typ
@@ -43,6 +43,7 @@ _Shopping list_
- A with 1 tab
- B with 2 tabs
+---
// This doesn't work because of mixed tabs and spaces.
- A with 2 spaces
- B with 2 tabs
diff --git a/tests/typ/compiler/array.typ b/tests/typ/compiler/array.typ
index ccde8598..e01f8896 100644
--- a/tests/typ/compiler/array.typ
+++ b/tests/typ/compiler/array.typ
@@ -208,17 +208,16 @@
// Error: 3 expected closing paren
{(}
-// Error: 2-3 expected expression, found closing paren
+// Error: 2-3 unexpected closing paren
{)}
-// Error: 4 expected comma
// Error: 4-6 unexpected end of block comment
{(1*/2)}
// Error: 6-8 invalid number suffix
{(1, 1u 2)}
-// Error: 3-4 expected expression, found comma
+// Error: 3-4 unexpected comma
{(,1)}
// Missing expression makes named pair incomplete, making this an empty array.
diff --git a/tests/typ/compiler/block.typ b/tests/typ/compiler/block.typ
index 7cf1f8be..7fb7738b 100644
--- a/tests/typ/compiler/block.typ
+++ b/tests/typ/compiler/block.typ
@@ -126,10 +126,12 @@
// Should output `3`.
{
- // Error: 7-10 expected identifier, found string
+ // Error: 6 expected identifier
+ // Error: 10 expected block
for "v"
// Error: 8 expected keyword `in`
+ // Error: 22 expected block
for v let z = 1 + 2
z
diff --git a/tests/typ/compiler/call.typ b/tests/typ/compiler/call.typ
index 7ea0a998..087e4694 100644
--- a/tests/typ/compiler/call.typ
+++ b/tests/typ/compiler/call.typ
@@ -44,7 +44,7 @@
}
---
-// Error: 28-47 duplicate argument
+// Error: 28-34 duplicate argument
#set text(family: "Arial", family: "Helvetica")
---
@@ -70,7 +70,8 @@
#f[1](2)
---
-// Error: 7-8 expected expression, found colon
+// Error: 7 expected expression
+// Error: 8 expected expression
#func(:)
// Error: 10-12 unexpected end of block comment
@@ -102,5 +103,4 @@
---
// Error: 2:1 expected quote
-// Error: 2:1 expected closing paren
#func("]
diff --git a/tests/typ/compiler/closure.typ b/tests/typ/compiler/closure.typ
index c7321204..f1604b19 100644
--- a/tests/typ/compiler/closure.typ
+++ b/tests/typ/compiler/closure.typ
@@ -146,6 +146,16 @@
}
---
+// Error: 11-12 duplicate parameter
+#let f(x, x) = none
+
+---
+// Error: 14-15 duplicate parameter
+// Error: 23-24 duplicate parameter
+// Error: 35-36 duplicate parameter
+#let f(a, b, a: none, b: none, c, b) = none
+
+---
// Error: 6-16 expected identifier, named pair or argument sink, found keyed pair
{(a, "named": b) => none}
diff --git a/tests/typ/compiler/dict.typ b/tests/typ/compiler/dict.typ
index 0170cb8b..f9a0b369 100644
--- a/tests/typ/compiler/dict.typ
+++ b/tests/typ/compiler/dict.typ
@@ -56,11 +56,11 @@
#test(dict, (a: 3, b: 1))
---
-// Error: 24-32 pair has duplicate key
+// Error: 24-29 duplicate key
{(first: 1, second: 2, first: 3)}
---
-// Error: 17-23 pair has duplicate key
+// Error: 17-20 duplicate key
{(a: 1, "b": 2, "a": 3)}
---
@@ -72,8 +72,11 @@
// Error: 4-5 expected named or keyed pair, found integer
// Error: 5 expected comma
// Error: 12-16 expected identifier or string, found boolean
-// Error: 17-18 expected expression, found colon
-{(:1 b:"", true::)}
+// Error: 17 expected expression
+{(:1 b:"", true:)}
+
+// Error: 3-8 expected identifier or string, found binary expression
+{(a + b: "hey")}
---
// Error: 3-15 cannot mutate a temporary value
diff --git a/tests/typ/compiler/field.typ b/tests/typ/compiler/field.typ
index 78439ae0..0195c6d8 100644
--- a/tests/typ/compiler/field.typ
+++ b/tests/typ/compiler/field.typ
@@ -36,5 +36,6 @@
= A
---
-// Error: 8-12 expected identifier, found boolean
+// Error: 8 expected identifier
+// Error: 8 expected semicolon or line break
{false.true}
diff --git a/tests/typ/compiler/for.typ b/tests/typ/compiler/for.typ
index f63b870e..7a530b73 100644
--- a/tests/typ/compiler/for.typ
+++ b/tests/typ/compiler/for.typ
@@ -94,7 +94,7 @@
// Error: 5 expected identifier
#for
-// Error: 7 expected identifier
+// Error: 5 expected identifier
#for//
// Error: 5 expected identifier
@@ -106,17 +106,18 @@
// Error: 10 expected expression
#for v in
-// Error: 15 expected body
+// Error: 15 expected block
#for v in iter
// Error: 5 expected identifier
#for
v in iter {}
-// Error: 7-10 expected identifier, found string
+// Error: 6 expected identifier
+// Error: 10 expected block
A#for "v" thing
-// Error: 6-9 expected identifier, found string
+// Error: 5 expected identifier
#for "v" in iter {}
// Error: 7 expected keyword `in`
diff --git a/tests/typ/compiler/if.typ b/tests/typ/compiler/if.typ
index 0d87c689..3b35ebd8 100644
--- a/tests/typ/compiler/if.typ
+++ b/tests/typ/compiler/if.typ
@@ -112,7 +112,7 @@
// Error: 4 expected expression
{if}
-// Error: 6 expected body
+// Error: 6 expected block
#if x
// Error: 1-6 unexpected keyword `else`
@@ -124,11 +124,11 @@
x {}
// Should output `something`.
-// Error: 6 expected body
+// Error: 6 expected block
#if x something
// Should output `A thing.`
-// Error: 19 expected body
+// Error: 19 expected block
A#if false {} else thing
#if a []else [b]
diff --git a/tests/typ/compiler/import.typ b/tests/typ/compiler/import.typ
index 6f2ac459..6b2d8075 100644
--- a/tests/typ/compiler/import.typ
+++ b/tests/typ/compiler/import.typ
@@ -81,21 +81,16 @@ This is never reached.
#import
---
-// Error: 26-29 expected identifier, found string
+// Error: 26-29 unexpected string
#import "module.typ": a, "b", c
---
-// Error: 22 expected import items
-#import "module.typ":
-
----
-// Error: 23-24 expected expression, found assignment operator
-// Error: 24 expected import items
+// Error: 23-24 unexpected equals sign
#import "module.typ": =
---
// An additional trailing comma.
-// Error: 31-32 expected expression, found comma
+// Error: 31-32 unexpected comma
#import "module.typ": a, b, c,,
---
@@ -105,7 +100,7 @@ This is never reached.
---
// A star in the list.
-// Error: 26-27 expected expression, found star
+// Error: 26-27 unexpected star
#import "module.typ": a, *, b
---
@@ -114,5 +109,10 @@ This is never reached.
#import "module.typ": *, a
---
-// Error: 13-17 expected identifier, found named pair
+// Error: 14-15 unexpected colon
+// Error: 16-17 unexpected integer
#import "": a: 1
+
+---
+// Error: 14 expected comma
+#import "": a b
diff --git a/tests/typ/compiler/let.typ b/tests/typ/compiler/let.typ
index d4f9510a..3a879ce7 100644
--- a/tests/typ/compiler/let.typ
+++ b/tests/typ/compiler/let.typ
@@ -39,7 +39,8 @@ Three
// Error: 5 expected identifier
{let}
-// Error: 6-9 expected identifier, found string
+// Error: 5 expected identifier
+// Error: 5 expected semicolon or line break
#let "v"
// Error: 7 expected semicolon or line break
@@ -48,7 +49,8 @@ Three
// Error: 9 expected expression
#let v =
-// Error: 6-9 expected identifier, found string
+// Error: 5 expected identifier
+// Error: 5 expected semicolon or line break
#let "v" = 1
// Terminated because expression ends.
@@ -61,7 +63,7 @@ Three
#let v5 = (1, 2 + ; Five
---
-// Error: 13 expected body
+// Error: 13 expected equals sign
#let func(x)
// Error: 15 expected expression
diff --git a/tests/typ/compiler/spread.typ b/tests/typ/compiler/spread.typ
index ff661ead..244e9fb9 100644
--- a/tests/typ/compiler/spread.typ
+++ b/tests/typ/compiler/spread.typ
@@ -60,7 +60,7 @@
#min(.."nope")
---
-// Error: 8-14 expected identifier, named pair or argument sink, found spread
+// Error: 10-14 expected identifier, found boolean
#let f(..true) = none
---
diff --git a/tests/typ/compiler/while.typ b/tests/typ/compiler/while.typ
index 3c28a32a..d495a84a 100644
--- a/tests/typ/compiler/while.typ
+++ b/tests/typ/compiler/while.typ
@@ -49,12 +49,12 @@
// Error: 7 expected expression
{while}
-// Error: 9 expected body
+// Error: 9 expected block
#while x
// Error: 7 expected expression
#while
x {}
-// Error: 9 expected body
+// Error: 9 expected block
#while x something
diff --git a/tests/typ/text/emphasis.typ b/tests/typ/text/emphasis.typ
index 27e3b977..f4570031 100644
--- a/tests/typ/text/emphasis.typ
+++ b/tests/typ/text/emphasis.typ
@@ -38,6 +38,6 @@ _Hello
World
---
-// Error: 1:12 expected star
-// Error: 2:1 expected star
-_Cannot *be_ interleaved*
+// Error: 25 expected star
+// Error: 25 expected underscore
+[_Cannot *be interleaved]
diff --git a/tests/typ/text/raw.typ b/tests/typ/text/raw.typ
index c17c8fec..96a23b66 100644
--- a/tests/typ/text/raw.typ
+++ b/tests/typ/text/raw.typ
@@ -41,7 +41,8 @@ The keyword ```rust let```.
// First line is not dedented and leading space is still possible.
``` A
B
- C```
+ C
+ ```
---
// Unterminated.