summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/ref/double-percent.pngbin0 -> 496 bytes
-rw-r--r--tests/suite/foundations/float.typ20
-rw-r--r--tests/suite/layout/length.typ27
-rw-r--r--tests/suite/layout/relative.typ8
4 files changed, 55 insertions, 0 deletions
diff --git a/tests/ref/double-percent.png b/tests/ref/double-percent.png
new file mode 100644
index 00000000..61a0d614
--- /dev/null
+++ b/tests/ref/double-percent.png
Binary files differ
diff --git a/tests/suite/foundations/float.typ b/tests/suite/foundations/float.typ
index 716ecd6b..a18e9f09 100644
--- a/tests/suite/foundations/float.typ
+++ b/tests/suite/foundations/float.typ
@@ -95,3 +95,23 @@
#float.inf \
#(-float.inf) \
#float.nan
+
+--- float-syntax-edge-cases ---
+// Test float syntax edge cases and which spans of text are highlighted. Valid
+// items are those not annotated with an error comment since syntax is handled
+// at parse time.
+
+#123.456e+789
+#000.000E-000
+#.9e0
+#123.E // this is a field access, so is fine syntactically
+#0.e
+#1.E+020
+// Error: 2-10 invalid number: 123.456e
+#123.456e
+// Error: 2-11 invalid number: 123.456e+
+#123.456e+
+// Error: 2-6 invalid number: .1E-
+#.1E-
+// Error: 2-4 invalid number: 0e
+#0e
diff --git a/tests/suite/layout/length.typ b/tests/suite/layout/length.typ
index 71d79da9..3409614f 100644
--- a/tests/suite/layout/length.typ
+++ b/tests/suite/layout/length.typ
@@ -79,3 +79,30 @@
// Error: 2-9 invalid base-2 prefix
// Hint: 2-9 numbers with a unit cannot have a base prefix
#0b100pt
+
+--- number-syntax-edge-cases ---
+// Test numeric syntax edge cases with suffixes and which spans of text are
+// highlighted. Valid items are those not annotated with an error comment since
+// syntax is handled at parse time.
+
+// All fine
+#2em
+#6.3e5em
+#.5pt
+#1.2E+0%
+#1.2e-0%
+#0.0e0deg
+#5in%
+#0.%
+// Error: 2-8 invalid number suffix: hello
+#1hello
+// Error: 2-7 invalid number suffix: infr
+#1infr
+// Error: 2-5 invalid number: 2E
+#2EM
+// Error: 2-8 invalid number: .1E-
+#.1E-fr
+// Error: 2-16 invalid number: 0.1E+
+#0.1E+fr123e456
+// Error: 2-11 invalid number: .1e-
+#.1e-fr123.456
diff --git a/tests/suite/layout/relative.typ b/tests/suite/layout/relative.typ
index 958aee3d..5a590892 100644
--- a/tests/suite/layout/relative.typ
+++ b/tests/suite/layout/relative.typ
@@ -5,3 +5,11 @@
#test((100% + 2pt).length, 2pt)
#test((100% + 2pt - 2pt).length, 0pt)
#test((56% + 2pt - 56%).ratio, 0%)
+
+--- double-percent ---
+// Test for two percent signs in a row.
+#3.1%%
+
+--- double-percent-error ---
+// Error: 7-8 the character `%` is not valid in code
+#(3.1%%)