summaryrefslogtreecommitdiff
path: root/tests/typ/text
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-12-20 14:18:29 +0100
committerLaurenz <laurmaedje@gmail.com>2021-12-21 00:20:24 +0100
commit11565a40b315212474f52eb576a9fd92b11f1132 (patch)
treec6b7afb35103065bc92b407094ca905bb75cfc73 /tests/typ/text
parent958f74f77707340f34ee36d09492bdb74523aa2a (diff)
Set Rules Episode IX: The Rise of Testing
Diffstat (limited to 'tests/typ/text')
-rw-r--r--tests/typ/text/em.typ17
-rw-r--r--tests/typ/text/par.typ10
-rw-r--r--tests/typ/text/whitespace.typ41
3 files changed, 44 insertions, 24 deletions
diff --git a/tests/typ/text/em.typ b/tests/typ/text/em.typ
new file mode 100644
index 00000000..d9b00f06
--- /dev/null
+++ b/tests/typ/text/em.typ
@@ -0,0 +1,17 @@
+// Test font-relative sizing.
+
+---
+#set text(size: 5pt)
+A // 5pt
+[
+ #set text(size: 200%)
+ B // 10pt
+ [
+ #set text(size: 150% + 1pt)
+ C // 16pt
+ #text(size: 200%)[D] // 32pt
+ E // 16pt
+ ]
+ F // 10pt
+]
+G // 5pt
diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ
index 771a6218..8bd43deb 100644
--- a/tests/typ/text/par.typ
+++ b/tests/typ/text/par.typ
@@ -16,6 +16,16 @@ To the right! Where the sunlight peeks behind the mountain.
Third
---
+// Test that paragraph spacing uses correct set rule.
+Hello
+
+#set par(spacing: 100pt)
+World
+#set par(spacing: 0pt)
+
+You
+
+---
// Test that paragraph break due to incompatibility respects
// spacing defined by the two adjacent paragraphs.
#let a = [#set par(spacing: 40pt);Hello]
diff --git a/tests/typ/text/whitespace.typ b/tests/typ/text/whitespace.typ
index 4c3d4db5..831a5543 100644
--- a/tests/typ/text/whitespace.typ
+++ b/tests/typ/text/whitespace.typ
@@ -1,32 +1,21 @@
// Test whitespace handling.
---
-// Spacing around let.
+// Spacing around code constructs.
A#let x = 1;B #test(x, 1) \
-A #let x = 2;B #test(x, 2) \
-A#let x = 3; B #test(x, 3)
+C #let x = 2;D #test(x, 2) \
+E#if true [F]G \
+H #if true{"I"} J \
+K #if true [L] else []M \
+#let c = true; N#while c [{c = false}O] P \
+#let c = true; Q #while c { c = false; "R" } S \
+T#for _ in (none,) {"U"}V
---
-// Spacing around if-else.
-A#if true [B]C \
-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
-
----
-// Spacing around while loop.
-#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
+// Test spacing with comments.
+A/**/B/**/C \
+A /**/ B/**/C \
+A /**/B/**/ C
---
// Test that a run consisting only of whitespace isn't trimmed.
@@ -37,7 +26,11 @@ A[#set text(serif); ]B
Left [#set text(serif);Right].
---
-// Test that space at start of line is not trimmed.
+// Test that linebreak consumed surrounding spaces.
+#align(center)[A \ B \ C]
+
+---
+// Test that space at start of non-backslash-linebreak line isn't trimmed.
A{"\n"} B
---