From 0804a9e25d865dc25d10aae22b0a39c4e16cab19 Mon Sep 17 00:00:00 2001 From: MALO <57839069+MDLC01@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:30:40 +0200 Subject: Use/allow U+2212 MINUS SIGN instead of U+002D HYPHEN MINUS everywhere (#2318) --- tests/ref/compiler/array.png | Bin 8306 -> 19884 bytes tests/ref/compiler/repr-color-gradient.png | Bin 53933 -> 101911 bytes tests/ref/layout/grid-2.png | Bin 14178 -> 61931 bytes tests/ref/text/edge.png | Bin 28077 -> 58153 bytes tests/ref/text/numbers.png | Bin 0 -> 183933 bytes tests/typ/compiler/methods.typ | 4 +- tests/typ/compute/calc.typ | 6 ++ tests/typ/compute/construct.typ | 2 +- tests/typ/text/numbers.typ | 110 +++++++++++++++++++++++++++++ 9 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 tests/ref/text/numbers.png create mode 100644 tests/typ/text/numbers.typ (limited to 'tests') diff --git a/tests/ref/compiler/array.png b/tests/ref/compiler/array.png index 9b6bf8b3..b97dd317 100644 Binary files a/tests/ref/compiler/array.png and b/tests/ref/compiler/array.png differ diff --git a/tests/ref/compiler/repr-color-gradient.png b/tests/ref/compiler/repr-color-gradient.png index 53c734c9..25aae2e3 100644 Binary files a/tests/ref/compiler/repr-color-gradient.png and b/tests/ref/compiler/repr-color-gradient.png differ diff --git a/tests/ref/layout/grid-2.png b/tests/ref/layout/grid-2.png index 23874076..ac1f7014 100644 Binary files a/tests/ref/layout/grid-2.png and b/tests/ref/layout/grid-2.png differ diff --git a/tests/ref/text/edge.png b/tests/ref/text/edge.png index 2226af9d..ee5e68d3 100644 Binary files a/tests/ref/text/edge.png and b/tests/ref/text/edge.png differ diff --git a/tests/ref/text/numbers.png b/tests/ref/text/numbers.png new file mode 100644 index 00000000..f4d96c17 Binary files /dev/null and b/tests/ref/text/numbers.png 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) -- cgit v1.2.3