summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-03-27 21:52:39 +0100
committerLaurenz <laurmaedje@gmail.com>2021-03-27 21:52:39 +0100
commit57ca9628c14378e8816a8a1f1530ae69c2269907 (patch)
tree01c4dfa7be25047b3f50fc7a186b03d2cd3394b7 /tests/typ
parent76fc4cca62f5b955200b2c62cc85b69eea491ece (diff)
Better space coalescing logic 🌧
This creates a smaller state machine helper type for softness coalescing, which does not own the resulting nodes. While this creates a bit more duplication in stack and par builder, it makes it a lot easier to integrate additional logic into the paragraph builder. Furthermore: - Line breaks are now "hard", that is, not coalesced with each other. - Text nodes with equal style are now merged allowing for example `f{}i` to form a ligature.
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/control/for.typ4
-rw-r--r--tests/typ/expand.typ2
-rw-r--r--tests/typ/expr/call.typ2
-rw-r--r--tests/typ/library/font.typ2
-rw-r--r--tests/typ/markup/linebreak.typ14
-rw-r--r--tests/typ/markup/nbsp.typ3
-rw-r--r--tests/typ/repr.typ12
-rw-r--r--tests/typ/spacing.typ8
8 files changed, 20 insertions, 27 deletions
diff --git a/tests/typ/control/for.typ b/tests/typ/control/for.typ
index 5eaa6ae8..bca1af46 100644
--- a/tests/typ/control/for.typ
+++ b/tests/typ/control/for.typ
@@ -14,8 +14,8 @@
// Dictionary is not traversed in insertion order.
// Should output `age: 1, name: Typst,`.
-#for k, v in (name: "Typst", age: 2) [
- {k}: {v}, \
+#for k, v in (Name: "Typst", Age: 2) [
+ {k}: {v}.
]
// String.
diff --git a/tests/typ/expand.typ b/tests/typ/expand.typ
index 23044744..8b858a4e 100644
--- a/tests/typ/expand.typ
+++ b/tests/typ/expand.typ
@@ -7,7 +7,7 @@
// Top-level paragraph fills page, boxed paragraph only when width is fixed.
L #right[R] \
#rect(width: 50pt)[L #right[R]] \
-#rect[L #right[R]] \
+#rect[L #right[R]]
// Pad inherits expansion behaviour.
#pad[PL #right[PR]] \
diff --git a/tests/typ/expr/call.typ b/tests/typ/expr/call.typ
index 0e941124..dcf11806 100644
--- a/tests/typ/expr/call.typ
+++ b/tests/typ/expr/call.typ
@@ -60,7 +60,7 @@
#args[a] \
#args(a) \
#args(a, [b]) \
-#args(a)[b] \
+#args(a)[b]
// Template can be argument or body depending on whitespace.
#if "template" == type[b] [Sure ]
diff --git a/tests/typ/library/font.typ b/tests/typ/library/font.typ
index 13f71125..397452e3 100644
--- a/tests/typ/library/font.typ
+++ b/tests/typ/library/font.typ
@@ -53,7 +53,7 @@ Emoji: 🐪, 🌋, 🏞
#font(sans-serif: "PT Sans")
#font(sans-serif)[Sans-serif.] \
#font(monospace)[Monospace.] \
-#font(monospace, monospace: ("Nope", "Latin Modern Math"))[Math.] \
+#font(monospace, monospace: ("Nope", "Latin Modern Math"))[Math.]
---
// Ref: false
diff --git a/tests/typ/markup/linebreak.typ b/tests/typ/markup/linebreak.typ
index a0a501b6..b1b83dcc 100644
--- a/tests/typ/markup/linebreak.typ
+++ b/tests/typ/markup/linebreak.typ
@@ -10,17 +10,11 @@ Line \ Break
// Directly before word does not work.
No \Break
----
-// Leading line break.
-\ Leading
-
-// Trailing before paragraph break.
-Trailing 1 \
+\ Before
-Trailing 2
+Multiple \ \ \
-// Trailing before end of document.
-Trailing 3 \
+Times
---
#let linebreak() = [
@@ -28,4 +22,4 @@ Trailing 3 \
#circle(radius: 2pt, fill: #000) \
]
-A \ B \ C \
+A \ B \ C
diff --git a/tests/typ/markup/nbsp.typ b/tests/typ/markup/nbsp.typ
index 5af6c84f..372268eb 100644
--- a/tests/typ/markup/nbsp.typ
+++ b/tests/typ/markup/nbsp.typ
@@ -1,5 +1,4 @@
// Test the non breaking space.
---
-// Parsed correctly, but not actually doing anything at the moment.
-The non-breaking~space does not work.
+The non-breaking~space does work.
diff --git a/tests/typ/repr.typ b/tests/typ/repr.typ
index cf137745..f2404510 100644
--- a/tests/typ/repr.typ
+++ b/tests/typ/repr.typ
@@ -9,7 +9,7 @@
{name} \
{ke-bab} \
-{α} \
+{α}
// Error: 2-3 unknown variable
{_}
@@ -18,7 +18,7 @@
// Literal values.
{none} (empty) \
{true} \
-{false} \
+{false}
---
// Numerical values.
@@ -33,16 +33,16 @@
{2.5rad} \
{45deg} \
// Not in monospace via repr.
-#repr(45deg) \
+#repr(45deg)
---
// Colors.
-{#f7a20500} \
+{#f7a20500}
---
// Strings and escaping.
{"hi"} \
-{"a\n[]\"\u{1F680}string"} \
+{"a\n[]\"\u{1F680}string"}
---
// Templates.
@@ -54,4 +54,4 @@
{rect} \
{f} \
-{() => none} \
+{() => none}
diff --git a/tests/typ/spacing.typ b/tests/typ/spacing.typ
index ccaf084a..bb86a59c 100644
--- a/tests/typ/spacing.typ
+++ b/tests/typ/spacing.typ
@@ -7,7 +7,7 @@
A#let;B \
A#let x = 1;B #test(x, 1) \
A #let x = 2;B #test(x, 2) \
-A#let x = 3; B #test(x, 3) \
+A#let x = 3; B #test(x, 3)
---
// Spacing around if-else.
@@ -17,7 +17,7 @@ A#if true [B] C \
A #if true{"B"}C \
A #if true{"B"} C \
A#if false [] #else [B]C \
-A#if true [B] #else [] C \
+A#if true [B] #else [] C
---
// Spacing around while loop.
@@ -25,11 +25,11 @@ A#if true [B] #else [] C \
#let c = true; A#while c [{c = false}B]C \
#let c = true; A#while c [{c = false}B] C \
#let c = true; A #while c { c = false; "B" }C \
-#let c = true; A #while c { c = false; "B" } C \
+#let c = true; A #while c { c = false; "B" } C
---
// Spacing around for loop.
A#for _ in (none,) [B]C \
A#for _ in (none,) [B] C \
-A #for _ in (none,) {"B"}C \
+A #for _ in (none,) {"B"}C