summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMALO <57839069+MDLC01@users.noreply.github.com>2023-10-09 15:30:40 +0200
committerGitHub <noreply@github.com>2023-10-09 15:30:40 +0200
commit0804a9e25d865dc25d10aae22b0a39c4e16cab19 (patch)
tree80550c88a91238e8018ccfb89aae891a7e4c368c /tests
parentdf49d3f0c6ea17e9dcf552106f7b5464bc99c4dc (diff)
Use/allow U+2212 MINUS SIGN instead of U+002D HYPHEN MINUS everywhere (#2318)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/compiler/array.pngbin8306 -> 19884 bytes
-rw-r--r--tests/ref/compiler/repr-color-gradient.pngbin53933 -> 101911 bytes
-rw-r--r--tests/ref/layout/grid-2.pngbin14178 -> 61931 bytes
-rw-r--r--tests/ref/text/edge.pngbin28077 -> 58153 bytes
-rw-r--r--tests/ref/text/numbers.pngbin0 -> 183933 bytes
-rw-r--r--tests/typ/compiler/methods.typ4
-rw-r--r--tests/typ/compute/calc.typ6
-rw-r--r--tests/typ/compute/construct.typ2
-rw-r--r--tests/typ/text/numbers.typ110
9 files changed, 119 insertions, 3 deletions
diff --git a/tests/ref/compiler/array.png b/tests/ref/compiler/array.png
index 9b6bf8b3..b97dd317 100644
--- a/tests/ref/compiler/array.png
+++ b/tests/ref/compiler/array.png
Binary files differ
diff --git a/tests/ref/compiler/repr-color-gradient.png b/tests/ref/compiler/repr-color-gradient.png
index 53c734c9..25aae2e3 100644
--- a/tests/ref/compiler/repr-color-gradient.png
+++ b/tests/ref/compiler/repr-color-gradient.png
Binary files differ
diff --git a/tests/ref/layout/grid-2.png b/tests/ref/layout/grid-2.png
index 23874076..ac1f7014 100644
--- a/tests/ref/layout/grid-2.png
+++ b/tests/ref/layout/grid-2.png
Binary files differ
diff --git a/tests/ref/text/edge.png b/tests/ref/text/edge.png
index 2226af9d..ee5e68d3 100644
--- a/tests/ref/text/edge.png
+++ b/tests/ref/text/edge.png
Binary files differ
diff --git a/tests/ref/text/numbers.png b/tests/ref/text/numbers.png
new file mode 100644
index 00000000..f4d96c17
--- /dev/null
+++ b/tests/ref/text/numbers.png
Binary files differ
diff --git a/tests/typ/compiler/methods.typ b/tests/typ/compiler/methods.typ
index f1017eb5..f7e7ed8f 100644
--- a/tests/typ/compiler/methods.typ
+++ b/tests/typ/compiler/methods.typ
@@ -76,7 +76,7 @@
#test((5em + 6in).abs.inches(), 6.0)
---
-// Error: 2-21 cannot convert a length with non-zero em units (`-6pt + 10.5em`) to pt
+// Error: 2-21 cannot convert a length with non-zero em units (`−6pt + 10.5em`) to pt
// Hint: 2-21 use `length.abs.pt()` instead to ignore its em component
#(10.5em - 6pt).pt()
@@ -86,7 +86,7 @@
#(3em).cm()
---
-// Error: 2-20 cannot convert a length with non-zero em units (`-226.77pt + 93em`) to mm
+// Error: 2-20 cannot convert a length with non-zero em units (`−226.77pt + 93em`) to mm
// Hint: 2-20 use `length.abs.mm()` instead to ignore its em component
#(93em - 80mm).mm()
diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ
index 536c637a..24411ecf 100644
--- a/tests/typ/compute/calc.typ
+++ b/tests/typ/compute/calc.typ
@@ -7,10 +7,16 @@
#test(int(true), 1)
#test(int(10), 10)
#test(int("150"), 150)
+#test(int("-834"), -834)
+#test(int("\u{2212}79"), -79)
#test(int(10 / 3), 3)
#test(float(10), 10.0)
#test(float(50% * 30%), 0.15)
#test(float("31.4e-1"), 3.14)
+#test(float("31.4e\u{2212}1"), 3.14)
+#test(float("3.1415"), 3.1415)
+#test(float("-7654.321"), -7654.321)
+#test(float("\u{2212}7654.321"), -7654.321)
#test(type(float(10)), float)
---
diff --git a/tests/typ/compute/construct.typ b/tests/typ/compute/construct.typ
index 6980c922..d5ded96a 100644
--- a/tests/typ/compute/construct.typ
+++ b/tests/typ/compute/construct.typ
@@ -162,7 +162,7 @@
// Test conversion to string.
#test(str(123), "123")
#test(str(123, base: 3), "11120")
-#test(str(-123, base: 16), "-7b")
+#test(str(-123, base: 16), "−7b")
#test(str(9223372036854775807, base: 36), "1y2p0ij32e8e7")
#test(str(50.14), "50.14")
#test(str(10 / 3).len() > 10, true)
diff --git a/tests/typ/text/numbers.typ b/tests/typ/text/numbers.typ
new file mode 100644
index 00000000..a35798d1
--- /dev/null
+++ b/tests/typ/text/numbers.typ
@@ -0,0 +1,110 @@
+// Test how numbers are displayed.
+
+---
+// Test numbers in text mode.
+12 \
+12.0 \
+3.14 \
+1234567890 \
+0123456789 \
+0 \
+0.0 \
++0 \
++0.0 \
+-0 \
+-0.0 \
+-1 \
+-3.14 \
+-9876543210 \
+-0987654321 \
+٣٫١٤ \
+-٣٫١٤ \
+-¾ \
+#text(fractions: true)[-3/2] \
+2022 - 2023 \
+2022 -- 2023 \
+2022--2023 \
+2022-2023 \
+٢٠٢٢ - ٢٠٢٣ \
+٢٠٢٢ -- ٢٠٢٣ \
+٢٠٢٢--٢٠٢٣ \
+٢٠٢٢-٢٠٢٣ \
+-500 -- -400
+
+---
+// Test integers.
+#12 \
+#1234567890 \
+#0123456789 \
+#0 \
+#(-0) \
+#(-1) \
+#(-9876543210) \
+#(-0987654321) \
+#(4 - 8)
+
+---
+// Test floats.
+#12.0 \
+#3.14 \
+#1234567890.0 \
+#0123456789.0 \
+#0.0 \
+#(-0.0) \
+#(-1.0) \
+#(-9876543210.0) \
+#(-0987654321.0) \
+#(-3.14) \
+#(4.0 - 8.0)
+
+---
+// Test the `str` function with integers.
+#str(12) \
+#str(1234567890) \
+#str(0123456789) \
+#str(0) \
+#str(-0) \
+#str(-1) \
+#str(-9876543210) \
+#str(-0987654321) \
+#str(4 - 8)
+
+---
+// Test the `str` function with floats.
+#str(12.0) \
+#str(3.14) \
+#str(1234567890.0) \
+#str(0123456789.0) \
+#str(0.0) \
+#str(-0.0) \
+#str(-1.0) \
+#str(-9876543210.0) \
+#str(-0987654321.0) \
+#str(-3.14) \
+#str(4.0 - 8.0)
+
+---
+// Test the `repr` function with integers.
+#repr(12) \
+#repr(1234567890) \
+#repr(0123456789) \
+#repr(0) \
+#repr(-0) \
+#repr(-1) \
+#repr(-9876543210) \
+#repr(-0987654321) \
+#repr(4 - 8)
+
+---
+// Test the `repr` function with floats.
+#repr(12.0) \
+#repr(3.14) \
+#repr(1234567890.0) \
+#repr(0123456789.0) \
+#repr(0.0) \
+#repr(-0.0) \
+#repr(-1.0) \
+#repr(-9876543210.0) \
+#repr(-0987654321.0) \
+#repr(-3.14) \
+#repr(4.0 - 8.0)