summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-06-10 16:46:01 +0200
committerLaurenz <laurmaedje@gmail.com>2021-06-10 16:46:01 +0200
commit5611c26577c4cf6d52b9b66b7b1a32253aa23ec1 (patch)
treeb06a64845ef691700aed7fd0ed1e22dd064cc742 /tests/typ
parentbce553a991f19b2b5bb9efef6b74bd12e15a10c6 (diff)
Restructure tests
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/code/repr.typ14
-rw-r--r--tests/typ/coma.typ (renamed from tests/typ/full/coma.typ)2
-rw-r--r--tests/typ/insert/circle.typ (renamed from tests/typ/library/circle.typ)0
-rw-r--r--tests/typ/insert/ellipse.typ (renamed from tests/typ/library/ellipse.typ)0
-rw-r--r--tests/typ/insert/image.typ (renamed from tests/typ/library/image.typ)4
-rw-r--r--tests/typ/insert/rect.typ (renamed from tests/typ/library/rect.typ)0
-rw-r--r--tests/typ/insert/square.typ (renamed from tests/typ/library/square.typ)0
-rw-r--r--tests/typ/layout/grid-1.typ (renamed from tests/typ/library/grid.typ)2
-rw-r--r--tests/typ/layout/grid-2.typ (renamed from tests/typ/library/grid-table.typ)0
-rw-r--r--tests/typ/layout/pad.typ (renamed from tests/typ/library/pad.typ)0
-rw-r--r--tests/typ/layout/page.typ (renamed from tests/typ/library/page.typ)4
-rw-r--r--tests/typ/layout/pagebreak.typ (renamed from tests/typ/library/pagebreak.typ)2
-rw-r--r--tests/typ/layout/spacing.typ (renamed from tests/typ/library/spacing.typ)0
-rw-r--r--tests/typ/layout/stack.typ (renamed from tests/typ/library/stack.typ)2
-rw-r--r--tests/typ/library/lang.typ16
-rw-r--r--tests/typ/markup/basic.typ12
-rw-r--r--tests/typ/markup/linebreak.typ4
-rw-r--r--tests/typ/markup/shorthands.typ7
-rw-r--r--tests/typ/text/bidi.typ17
-rw-r--r--tests/typ/text/font.typ (renamed from tests/typ/library/font.typ)4
-rw-r--r--tests/typ/text/par.typ (renamed from tests/typ/library/paragraph.typ)4
-rw-r--r--tests/typ/utility/calc.typ (renamed from tests/typ/library/math.typ)2
-rw-r--r--tests/typ/utility/color.typ (renamed from tests/typ/library/basic.typ)6
23 files changed, 44 insertions, 58 deletions
diff --git a/tests/typ/code/repr.typ b/tests/typ/code/repr.typ
index f2404510..eacbf8e8 100644
--- a/tests/typ/code/repr.typ
+++ b/tests/typ/code/repr.typ
@@ -2,7 +2,6 @@
---
// Variables.
-
#let name = "Typst"
#let ke-bab = "Kebab!"
#let α = "Alpha"
@@ -31,9 +30,7 @@
{4.5cm} \
{12e1pt} \
{2.5rad} \
-{45deg} \
-// Not in monospace via repr.
-#repr(45deg)
+{45deg}
---
// Colors.
@@ -55,3 +52,12 @@
{rect} \
{f} \
{() => none}
+
+---
+// Test using the `repr` function.
+
+// Returns a string.
+#test(repr((1, 2, false, )), "(1, 2, false)")
+
+// Not in monospace
+#repr(23deg)
diff --git a/tests/typ/full/coma.typ b/tests/typ/coma.typ
index 78a703a9..810d61b8 100644
--- a/tests/typ/full/coma.typ
+++ b/tests/typ/coma.typ
@@ -46,4 +46,4 @@ von _v_ zu einem Blatt. Die Höhe des Baumes ist die Höhe der Wurzel.
// The `image` function returns a "template" value of the same type as
// the `[...]` literals.
-#align(center, image("../../res/graph.png", width: 75%))
+#align(center, image("../res/graph.png", width: 75%))
diff --git a/tests/typ/library/circle.typ b/tests/typ/insert/circle.typ
index d2fa928e..d2fa928e 100644
--- a/tests/typ/library/circle.typ
+++ b/tests/typ/insert/circle.typ
diff --git a/tests/typ/library/ellipse.typ b/tests/typ/insert/ellipse.typ
index 9b10eded..9b10eded 100644
--- a/tests/typ/library/ellipse.typ
+++ b/tests/typ/insert/ellipse.typ
diff --git a/tests/typ/library/image.typ b/tests/typ/insert/image.typ
index 1fa128f0..35087c2e 100644
--- a/tests/typ/library/image.typ
+++ b/tests/typ/insert/image.typ
@@ -13,8 +13,8 @@
// Error: 8-29 file not found
#image("path/does/not/exist")
-// Error: 8-20 failed to load image
-#image("./font.typ")
+// Error: 8-21 failed to load image
+#image("./image.typ")
---
// Test configuring the size and fitting behaviour of images.
diff --git a/tests/typ/library/rect.typ b/tests/typ/insert/rect.typ
index f450064a..f450064a 100644
--- a/tests/typ/library/rect.typ
+++ b/tests/typ/insert/rect.typ
diff --git a/tests/typ/library/square.typ b/tests/typ/insert/square.typ
index 649d31c0..649d31c0 100644
--- a/tests/typ/library/square.typ
+++ b/tests/typ/insert/square.typ
diff --git a/tests/typ/library/grid.typ b/tests/typ/layout/grid-1.typ
index afb43684..6a4aee87 100644
--- a/tests/typ/library/grid.typ
+++ b/tests/typ/layout/grid-1.typ
@@ -1,4 +1,4 @@
-// Test the `grid` function.
+// Test grid layouts.
---
#let rect(width, color) = rect(width: width, height: 2cm, fill: color)
diff --git a/tests/typ/library/grid-table.typ b/tests/typ/layout/grid-2.typ
index 277e695c..277e695c 100644
--- a/tests/typ/library/grid-table.typ
+++ b/tests/typ/layout/grid-2.typ
diff --git a/tests/typ/library/pad.typ b/tests/typ/layout/pad.typ
index 3726ce53..3726ce53 100644
--- a/tests/typ/library/pad.typ
+++ b/tests/typ/layout/pad.typ
diff --git a/tests/typ/library/page.typ b/tests/typ/layout/page.typ
index 7f9a0d2c..cf787e5d 100644
--- a/tests/typ/library/page.typ
+++ b/tests/typ/layout/page.typ
@@ -1,8 +1,6 @@
-// Test the `page` function.
-
----
// Test configuring page sizes and margins.
+---
// Set width and height.
#page(width: 120pt, height: 120pt)
#page(width: 40pt)[High]
diff --git a/tests/typ/library/pagebreak.typ b/tests/typ/layout/pagebreak.typ
index 26629f4b..bb7013ab 100644
--- a/tests/typ/library/pagebreak.typ
+++ b/tests/typ/layout/pagebreak.typ
@@ -1,4 +1,4 @@
-// Test the `pagebreak` function.
+// Test forced page breaks.
---
First of two
diff --git a/tests/typ/library/spacing.typ b/tests/typ/layout/spacing.typ
index bd38631e..bd38631e 100644
--- a/tests/typ/library/spacing.typ
+++ b/tests/typ/layout/spacing.typ
diff --git a/tests/typ/library/stack.typ b/tests/typ/layout/stack.typ
index d03a95c8..006a1412 100644
--- a/tests/typ/library/stack.typ
+++ b/tests/typ/layout/stack.typ
@@ -1,4 +1,4 @@
-// Test the `stack` function.
+// Test stack layouts.
---
#let rect(width, color) = rect(width: width, height: 1cm, fill: color)
diff --git a/tests/typ/library/lang.typ b/tests/typ/library/lang.typ
deleted file mode 100644
index 87d2c154..00000000
--- a/tests/typ/library/lang.typ
+++ /dev/null
@@ -1,16 +0,0 @@
-// Test the `lang` function.
-
----
-Left to right.
-
-#lang("ar")
-Right to left.
-
-#lang(dir: ltr)
-Back again.
-
----
-// Ref: false
-
-// Error: 12-15 must be horizontal
-#lang(dir: ttb)
diff --git a/tests/typ/markup/basic.typ b/tests/typ/markup/basic.typ
deleted file mode 100644
index 01582ceb..00000000
--- a/tests/typ/markup/basic.typ
+++ /dev/null
@@ -1,12 +0,0 @@
-// Test basic markup.
-
----
-A \ B \ C
-
----
-Paragraph breaks
-
-for you!
-
----
-The non-breaking~space does work.
diff --git a/tests/typ/markup/linebreak.typ b/tests/typ/markup/linebreak.typ
new file mode 100644
index 00000000..7fe8a718
--- /dev/null
+++ b/tests/typ/markup/linebreak.typ
@@ -0,0 +1,4 @@
+// Test line breaks.
+
+---
+A \ B \ C
diff --git a/tests/typ/markup/shorthands.typ b/tests/typ/markup/shorthands.typ
new file mode 100644
index 00000000..38471c9d
--- /dev/null
+++ b/tests/typ/markup/shorthands.typ
@@ -0,0 +1,7 @@
+// Test shorthands for unicode codepoints.
+
+---
+The non-breaking~space does work.
+
+---
+En dash: --
diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ
index 0d589930..078cb1f9 100644
--- a/tests/typ/text/bidi.typ
+++ b/tests/typ/text/bidi.typ
@@ -1,27 +1,27 @@
-// Test bidirectional text.
+// Test bidirectional text and language configuration.
---
// Test reordering with different top-level paragraph directions.
#let text = [Text טֶקסט]
#font("EB Garamond", "Noto Serif Hebrew")
-#lang("de") {text}
#lang("he") {text}
+#lang("de") {text}
---
-// Test that consecutiv, embedded LTR runs stay LTR.
+// Test that consecutive, embedded LTR runs stay LTR.
// Here, we have two runs: "A" and italic "B".
#let text = [أنت A_B_مطرC]
#font("EB Garamond", "Noto Sans Arabic")
-#lang("de") {text}
#lang("ar") {text}
+#lang("de") {text}
---
// Test that consecutive, embedded RTL runs stay RTL.
// Here, we have three runs: "גֶ", bold "שֶׁ", and "ם".
#let text = [Aגֶ*שֶׁ*םB]
#font("EB Garamond", "Noto Serif Hebrew")
-#lang("de") {text}
#lang("he") {text}
+#lang("de") {text}
---
// Test embedding up to level 4 with isolates.
@@ -47,3 +47,10 @@ Lריווח #h(1cm) R
#font("Noto Serif Hebrew", "EB Garamond")
#lang("he")
קרנפיםRh#image("../../res/rhino.png", height: 11pt)inoחיים
+
+---
+// Test the `lang` function.
+// Ref: false
+
+// Error: 12-15 must be horizontal
+#lang(dir: ttb)
diff --git a/tests/typ/library/font.typ b/tests/typ/text/font.typ
index 34b08f26..317037e2 100644
--- a/tests/typ/library/font.typ
+++ b/tests/typ/text/font.typ
@@ -1,8 +1,6 @@
-// Test the `font` function.
-
----
// Test configuring font properties.
+---
// Set same font size in three different ways.
#font(22pt)[A]
#font(200%)[A]
diff --git a/tests/typ/library/paragraph.typ b/tests/typ/text/par.typ
index a26aed84..4ce2f6f1 100644
--- a/tests/typ/library/paragraph.typ
+++ b/tests/typ/text/par.typ
@@ -1,8 +1,6 @@
-// Test the `paragraph` function.
-
----
// Test configuring paragraph properties.
+---
// FIXME: Word spacing doesn't work due to new shaping process.
#par(spacing: 10pt, leading: 25%, word-spacing: 1pt)
diff --git a/tests/typ/library/math.typ b/tests/typ/utility/calc.typ
index db234d9c..3bfc9802 100644
--- a/tests/typ/library/math.typ
+++ b/tests/typ/utility/calc.typ
@@ -1,4 +1,4 @@
-// Test math functions.
+// Test basic calculation functions.
// Ref: false
---
diff --git a/tests/typ/library/basic.typ b/tests/typ/utility/color.typ
index a6aa71af..2e40828b 100644
--- a/tests/typ/library/basic.typ
+++ b/tests/typ/utility/color.typ
@@ -1,11 +1,7 @@
-// Test basic functions.
+// Test color creation functions.
// Ref: false
---
-#test(type("hi"), "string")
-#test(repr((1, 2, false, )), "(1, 2, false)")
-
----
// Check the output.
#test(rgb(0.0, 0.3, 0.7), #004db3)