summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-13 17:22:33 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-13 17:22:33 +0100
commitc36a136e6f26ac99e58465ad072c282fe6dbaedf (patch)
treed2c21e28033a4af68460e0159203274cb03e074a /tests/typ
parent2aa4c5bfc6e35ca663aa77899975450e6a4a26de (diff)
Simpler diagnostic localization in tests ♻
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/arrays.typ18
-rw-r--r--tests/typ/basics.typ (renamed from tests/typ/basic-markup.typ)0
-rw-r--r--tests/typ/comments.typ13
-rw-r--r--tests/typ/dictionaries.typ14
-rw-r--r--tests/typ/escaping.typ23
-rw-r--r--tests/typ/func-font.typ21
-rw-r--r--tests/typ/func-hv.typ (renamed from tests/typ/func-h-and-v.typ)6
-rw-r--r--tests/typ/func-image.typ8
-rw-r--r--tests/typ/func-page.typ8
-rw-r--r--tests/typ/func-rgb.typ16
-rw-r--r--tests/typ/headings.typ7
11 files changed, 48 insertions, 86 deletions
diff --git a/tests/typ/arrays.typ b/tests/typ/arrays.typ
index adab2ad9..0b8fb866 100644
--- a/tests/typ/arrays.typ
+++ b/tests/typ/arrays.typ
@@ -13,25 +13,21 @@
, #003
,)}
----
-// Test errors.
-//
-// error: 2:3-2:3 expected closing paren
-// error: 4:4-4:6 expected expression, found end of block comment
-// error: 4:4-4:4 expected comma
-// error: 6:6-6:8 expected expression, found invalid token
-// error: 8:3-8:4 expected expression, found comma
-// error: 10:5-10:5 expected expression
-// error: 12:6-12:10 expected expression, found named pair
-
+// Error: 1:3-1:3 expected closing paren
{(}
+// Error: 2:4-2:6 expected expression, found end of block comment
+// Error: 1:4-1:4 expected comma
{(1*/2)}
+// Error: 1:6-1:8 expected expression, found invalid token
{(1, 1u 2)}
+// Error: 1:3-1:4 expected expression, found comma
{(,1)}
+// Error: 1:5-1:5 expected expression
{(a:)}
+// Error: 1:6-1:10 expected expression, found named pair
{(1, b: 2)}
diff --git a/tests/typ/basic-markup.typ b/tests/typ/basics.typ
index b7630e7f..b7630e7f 100644
--- a/tests/typ/basic-markup.typ
+++ b/tests/typ/basics.typ
diff --git a/tests/typ/comments.typ b/tests/typ/comments.typ
index 0dfb4b8e..56906d0c 100644
--- a/tests/typ/comments.typ
+++ b/tests/typ/comments.typ
@@ -1,22 +1,17 @@
-// Test interaction with words, spacing and expressions.
-
+// Test whether line comment acts as spacing.
A// you
B
+// Test whether block comment acts as spacing.
C/*
/* */
*/D
+// Test in expressions.
[dump /*1*/ a: "b" //
, 1]
----
-// Test error.
-//
-// ref: false
-// error: 3:7-3:9 unexpected end of block comment
-
-// No start of block comment.
+// Error: 1:7-1:9 unexpected end of block comment
/* */ */
// Unterminated block comment is okay.
diff --git a/tests/typ/dictionaries.typ b/tests/typ/dictionaries.typ
index 51e3eb3c..c729b92c 100644
--- a/tests/typ/dictionaries.typ
+++ b/tests/typ/dictionaries.typ
@@ -4,15 +4,11 @@
// Two pairs.
{(one: 1, two: 2)}
----
-// Test errors.
-//
-// error: 2:9-2:10 expected named pair, found expression
-// error: 4:4-4:5 expected named pair, found expression
-// error: 4:5-4:5 expected comma
-// error: 4:12-4:16 expected identifier
-// error: 4:17-4:18 expected expression, found colon
-
+// Error: 1:9-1:10 expected named pair, found expression
{(a: 1, b)}
+// Error: 4:4-4:5 expected named pair, found expression
+// Error: 3:5-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/typ/escaping.typ b/tests/typ/escaping.typ
index a562dcc0..cb663612 100644
--- a/tests/typ/escaping.typ
+++ b/tests/typ/escaping.typ
@@ -1,6 +1,4 @@
-// Test basic symbol escapes.
-
-// Escapable
+// Escapable symbols.
\\ \/ \[ \] \{ \} \* \_ \# \~ \` \$
// No need to escape.
@@ -12,21 +10,16 @@
// Escaped comments.
\//
\/\* \*\/
-\/* \*/
-
----
-// Test unicode escapes.
-//
-// error: 5:1-5:11 invalid unicode escape sequence
-// error: 8:6-8:6 expected closing brace
+\/* \*/ *
+// Test unicode escape sequence.
\u{1F3D5} == 🏕
-// Bad sequence.
+// Escaped escape sequence.
+\u{41} vs. \\u\{41\}
+
+// Error: 1:1-1:11 invalid unicode escape sequence
\u{FFFFFF}
-// Missing closing brace.
+// Error: 1:6-1:6 expected closing brace
\u{41*Bold*
-
-// Escaped escape sequence.
-\\u\{ABC\}
diff --git a/tests/typ/func-font.typ b/tests/typ/func-font.typ
index c73e3a1a..8199ecb4 100644
--- a/tests/typ/func-font.typ
+++ b/tests/typ/func-font.typ
@@ -43,23 +43,18 @@ New sans-serif. 🚀
---
// Test error cases.
-//
-// ref: false
-// error: 3:7-3:12 unexpected argument
-// error: 6:14-6:18 expected font style, found font weight
-// error: 6:28-6:34 expected font weight, found string
-// error: 6:43-6:44 expected font family or array of font families, found integer
-// warning: 9:15-9:19 must be between 100 and 900
-// error: 12:7-12:27 unexpected argument
-
-// Not one of the valid things for positional arguments.
+// Ref: false
+
+// Error: 1:7-1:12 unexpected argument
[font false]
-// Wrong types.
+// Error: 3:14-3:18 expected font style, found font weight
+// Error: 2:28-2:34 expected font weight, found string
+// Error: 1:43-1:44 expected font family or array of font families, found integer
[font style: bold, weight: "thin", serif: 0]
-// Weight out of range.
+// Warning: 1:15-1:19 must be between 100 and 900
[font weight: 2700]
-// Non-existing argument.
+// Error: 1:7-1:27 unexpected argument
[font something: "invalid"]
diff --git a/tests/typ/func-h-and-v.typ b/tests/typ/func-hv.typ
index 7b8843c8..f930bc12 100644
--- a/tests/typ/func-h-and-v.typ
+++ b/tests/typ/func-hv.typ
@@ -19,10 +19,6 @@ Relative [h 100%] spacing
3 [v 1cm] 4 [v -1cm] 5
]
----
-// Test error cases.
-//
-// error: 3:11-3:11 missing argument: spacing
-
// Missing spacing.
+// Error: 1:11-1:11 missing argument: spacing
Totally [h] ignored
diff --git a/tests/typ/func-image.typ b/tests/typ/func-image.typ
index 78a644c0..b0ca0357 100644
--- a/tests/typ/func-image.typ
+++ b/tests/typ/func-image.typ
@@ -35,12 +35,10 @@
---
// Test error cases.
//
-// ref: false
-// error: 3:8-3:29 failed to load image
-// error: 6:8-6:29 failed to load image
+// Ref: false
-// File does not exist.
+// Error: 1:8-1:29 failed to load image
[image "path/does/not/exist"]
-// File exists, but is no image.
+// Error: 1:8-1:29 failed to load image
[image "typ/image-error.typ"]
diff --git a/tests/typ/func-page.typ b/tests/typ/func-page.typ
index 6b9382b9..465a3469 100644
--- a/tests/typ/func-page.typ
+++ b/tests/typ/func-page.typ
@@ -47,12 +47,10 @@ Right to left!
---
// Test error cases.
//
-// ref: false
-// error: 3:7-3:18 unknown variable
-// error: 6:17-6:20 aligned axis
+// Ref: false
-// Invalid paper.
+// Error: 1:7-1:18 unknown variable
[page nonexistant]
-// Aligned axes.
+// Error: 1:17-1:20 aligned axis
[page main-dir: ltr]
diff --git a/tests/typ/func-rgb.typ b/tests/typ/func-rgb.typ
index e88b19bf..d29c2940 100644
--- a/tests/typ/func-rgb.typ
+++ b/tests/typ/func-rgb.typ
@@ -1,11 +1,4 @@
// Test the `rgb` function.
-//
-// warning: 9:6-9:9 must be between 0.0 and 1.0
-// warning: 9:11-9:15 must be between 0.0 and 1.0
-// error: 12:6-12:10 missing argument: blue component
-// error: 15:5-15:5 missing argument: red component
-// error: 15:5-15:5 missing argument: green component
-// error: 15:5-15:5 missing argument: blue component
// Check the output.
[rgb 0.0, 0.3, 0.7]
@@ -13,11 +6,14 @@
// Alpha channel.
[rgb 1.0, 0.0, 0.0, 0.5]
-// Value smaller than 0.0 and larger than 1.0
+// Warning: 2:6-2:9 must be between 0.0 and 1.0
+// Warning: 1:11-1:15 must be between 0.0 and 1.0
[rgb -30, 15.5, 0.5]
-// Missing blue component.
+// Error: 1:6-1:10 missing argument: blue component
[rgb 0, 1]
-// Missing all components.
+// Error: 3:5-3:5 missing argument: red component
+// Error: 2:5-2:5 missing argument: green component
+// Error: 1:5-1:5 missing argument: blue component
[rgb]
diff --git a/tests/typ/headings.typ b/tests/typ/headings.typ
index 3a115746..de98eddb 100644
--- a/tests/typ/headings.typ
+++ b/tests/typ/headings.typ
@@ -1,10 +1,10 @@
// Number of hashtags.
-//
-// warning: 5:1-5:8 section depth should not exceed 6
# One
### Three
###### Six
+
+// Warning: 1:1-1:8 section depth should not exceed 6
####### Seven
---
@@ -16,8 +16,6 @@
---
// Is no heading.
-//
-// error: 8:1-8:6 unexpected invalid token
\# No heading
@@ -25,6 +23,7 @@ Text with # hashtag
Nr#1
+// Error: 1:1-1:6 unexpected invalid token
#nope
---