summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-13 16:37:18 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-13 16:37:18 +0100
commit1cd687b681224a6a190fea5d542b92f147f9abf0 (patch)
tree471c106ceee8384f91aa0304fa21148493663177 /tests
parent274e008e2c775d9c8c888767a6baeaff9e99de9d (diff)
Move escaping tests to integration and extend them 🚚
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/escaping.pngbin0 -> 4320 bytes
-rw-r--r--tests/ref/headings.pngbin7991 -> 8197 bytes
-rw-r--r--tests/typ/escaping.typ32
-rw-r--r--tests/typ/headings.typ4
-rw-r--r--tests/typeset.rs4
5 files changed, 37 insertions, 3 deletions
diff --git a/tests/ref/escaping.png b/tests/ref/escaping.png
new file mode 100644
index 00000000..fedd3e58
--- /dev/null
+++ b/tests/ref/escaping.png
Binary files differ
diff --git a/tests/ref/headings.png b/tests/ref/headings.png
index b16e38a6..3deecf8f 100644
--- a/tests/ref/headings.png
+++ b/tests/ref/headings.png
Binary files differ
diff --git a/tests/typ/escaping.typ b/tests/typ/escaping.typ
new file mode 100644
index 00000000..a562dcc0
--- /dev/null
+++ b/tests/typ/escaping.typ
@@ -0,0 +1,32 @@
+// Test basic symbol escapes.
+
+// Escapable
+\\ \/ \[ \] \{ \} \* \_ \# \~ \` \$
+
+// No need to escape.
+( ) = ;
+
+// Unescapable.
+\a \: \; \( \)
+
+// Escaped comments.
+\//
+\/\* \*\/
+\/* \*/
+
+---
+// Test unicode escapes.
+//
+// error: 5:1-5:11 invalid unicode escape sequence
+// error: 8:6-8:6 expected closing brace
+
+\u{1F3D5} == 🏕
+
+// Bad sequence.
+\u{FFFFFF}
+
+// Missing closing brace.
+\u{41*Bold*
+
+// Escaped escape sequence.
+\\u\{ABC\}
diff --git a/tests/typ/headings.typ b/tests/typ/headings.typ
index 88c76ad3..3a115746 100644
--- a/tests/typ/headings.typ
+++ b/tests/typ/headings.typ
@@ -17,12 +17,14 @@
---
// Is no heading.
//
-// error: 4:1-4:6 unexpected invalid token
+// error: 8:1-8:6 unexpected invalid token
\# No heading
Text with # hashtag
+Nr#1
+
#nope
---
diff --git a/tests/typeset.rs b/tests/typeset.rs
index f3c41151..2b342c5b 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -213,14 +213,14 @@ fn test_part(i: usize, src: &str, env: &SharedEnv) -> (bool, Vec<Frame>) {
ok = false;
for diag in &diags {
- if ref_diags.binary_search(diag).is_err() {
+ if !ref_diags.contains(diag) {
print!(" Unexpected | ");
print_diag(diag, &map);
}
}
for diag in &ref_diags {
- if diags.binary_search(diag).is_err() {
+ if !diags.contains(diag) {
print!(" Missing | ");
print_diag(diag, &map);
}