summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/world.rs2
-rw-r--r--tests/suite/foundations/type.typ54
2 files changed, 55 insertions, 1 deletions
diff --git a/tests/src/world.rs b/tests/src/world.rs
index 5c267832..56ebc868 100644
--- a/tests/src/world.rs
+++ b/tests/src/world.rs
@@ -251,6 +251,6 @@ fn lines(
(1..=count)
.map(|n| numbering.apply(engine, context, &[n]))
.collect::<SourceResult<Array>>()?
- .join(Some('\n'.into_value()), None)
+ .join(engine, span, Some('\n'.into_value()), None)
.at(span)
}
diff --git a/tests/suite/foundations/type.typ b/tests/suite/foundations/type.typ
index 068b858d..60f9d0ef 100644
--- a/tests/suite/foundations/type.typ
+++ b/tests/suite/foundations/type.typ
@@ -2,6 +2,60 @@
#test(type(1), int)
#test(type(ltr), direction)
#test(type(10 / 3), float)
+#test(type(10) == int, true)
+#test(type(10) != int, false)
+
+--- type-string-compatibility-add ---
+// Warning: 7-23 adding strings and types is deprecated
+// Hint: 7-23 convert the type to a string with `str` first
+#test("is " + type(10), "is integer")
+// Warning: 7-23 adding strings and types is deprecated
+// Hint: 7-23 convert the type to a string with `str` first
+#test(type(10) + " is", "integer is")
+
+--- type-string-compatibility-join ---
+// Warning: 16-24 joining strings and types is deprecated
+// Hint: 16-24 convert the type to a string with `str` first
+#test({ "is "; type(10) }, "is integer")
+// Warning: 19-24 joining strings and types is deprecated
+// Hint: 19-24 convert the type to a string with `str` first
+#test({ type(10); " is" }, "integer is")
+
+--- type-string-compatibility-equal ---
+// Warning: 7-28 comparing strings with types is deprecated
+// Hint: 7-28 compare with the literal type instead
+// Hint: 7-28 this comparison will always return `false` in future Typst releases
+#test(type(10) == "integer", true)
+// Warning: 7-26 comparing strings with types is deprecated
+// Hint: 7-26 compare with the literal type instead
+// Hint: 7-26 this comparison will always return `false` in future Typst releases
+#test(type(10) != "float", true)
+
+--- type-string-compatibility-in-array ---
+// Warning: 7-35 comparing strings with types is deprecated
+// Hint: 7-35 compare with the literal type instead
+// Hint: 7-35 this comparison will always return `false` in future Typst releases
+#test(int in ("integer", "string"), true)
+// Warning: 7-37 comparing strings with types is deprecated
+// Hint: 7-37 compare with the literal type instead
+// Hint: 7-37 this comparison will always return `false` in future Typst releases
+#test(float in ("integer", "string"), false)
+
+--- type-string-compatibility-in-str ---
+// Warning: 7-35 checking whether a type is contained in a string is deprecated
+// Hint: 7-35 this compatibility behavior only exists because `type` used to return a string
+#test(int in "integers or strings", true)
+// Warning: 7-35 checking whether a type is contained in a string is deprecated
+// Hint: 7-35 this compatibility behavior only exists because `type` used to return a string
+#test(str in "integers or strings", true)
+// Warning: 7-37 checking whether a type is contained in a string is deprecated
+// Hint: 7-37 this compatibility behavior only exists because `type` used to return a string
+#test(float in "integers or strings", false)
+
+--- type-string-compatibility-in-dict ---
+// Warning: 7-37 checking whether a type is contained in a dictionary is deprecated
+// Hint: 7-37 this compatibility behavior only exists because `type` used to return a string
+#test(int in (integer: 1, string: 2), true)
--- issue-3110-type-constructor ---
// Let the error message report the type name.