summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-01-30 12:50:58 +0100
committerLaurenz <laurmaedje@gmail.com>2022-01-30 22:46:59 +0100
commit8d1ce390e21ce0a5812a4211c893ec359906d6f1 (patch)
tree5dbe1ad96af8ce8f9f01887340fe06025462e959 /tests
parentd7072f378fef733ae994fd9a1e767df4e4dd878e (diff)
Rework strong and emph
- Star and underscore not parsed as strong/emph inside of words - Stars/underscores must be balanced and they cannot go over paragraph break - New `strong` and `emph` classes
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/markup/emph-strong.pngbin0 -> 6988 bytes
-rw-r--r--tests/ref/markup/emph.pngbin3772 -> 0 bytes
-rw-r--r--tests/ref/markup/strong.pngbin3481 -> 0 bytes
-rw-r--r--tests/ref/style/set-toggle.pngbin1188 -> 0 bytes
-rw-r--r--tests/typ/code/ops.typ2
-rw-r--r--tests/typ/markup/emph-strong.typ33
-rw-r--r--tests/typ/markup/emph.typ11
-rw-r--r--tests/typ/markup/escape.typ2
-rw-r--r--tests/typ/markup/strong.typ11
-rw-r--r--tests/typ/style/set-toggle.typ10
-rw-r--r--tests/typ/style/wrap.typ2
-rw-r--r--tests/typ/text/bidi.typ4
-rw-r--r--tests/typ/text/linebreaks.typ2
-rw-r--r--tests/typeset.rs5
14 files changed, 43 insertions, 39 deletions
diff --git a/tests/ref/markup/emph-strong.png b/tests/ref/markup/emph-strong.png
new file mode 100644
index 00000000..cce98812
--- /dev/null
+++ b/tests/ref/markup/emph-strong.png
Binary files differ
diff --git a/tests/ref/markup/emph.png b/tests/ref/markup/emph.png
deleted file mode 100644
index 6b3bfb2d..00000000
--- a/tests/ref/markup/emph.png
+++ /dev/null
Binary files differ
diff --git a/tests/ref/markup/strong.png b/tests/ref/markup/strong.png
deleted file mode 100644
index 53062e9a..00000000
--- a/tests/ref/markup/strong.png
+++ /dev/null
Binary files differ
diff --git a/tests/ref/style/set-toggle.png b/tests/ref/style/set-toggle.png
deleted file mode 100644
index daaa3d6c..00000000
--- a/tests/ref/style/set-toggle.png
+++ /dev/null
Binary files differ
diff --git a/tests/typ/code/ops.typ b/tests/typ/code/ops.typ
index be2cdb48..e3e2e855 100644
--- a/tests/typ/code/ops.typ
+++ b/tests/typ/code/ops.typ
@@ -4,7 +4,7 @@
---
// Test template addition.
// Ref: true
-{[*Hello ] + [world!]}
+{[*Hello* ] + [world!]}
---
// Test math operators.
diff --git a/tests/typ/markup/emph-strong.typ b/tests/typ/markup/emph-strong.typ
new file mode 100644
index 00000000..9bdb5059
--- /dev/null
+++ b/tests/typ/markup/emph-strong.typ
@@ -0,0 +1,33 @@
+// Test emph and strong.
+
+---
+// Basic.
+_Emphasized and *strong* words!_
+
+// Inside of a word it's a normal underscore or star.
+hello_world Nutzer*innen
+
+// Can contain paragraph in child template.
+_Still [
+
+] emphasized._
+
+---
+// Inside of words can still use the functions.
+P#strong[art]ly em#emph[phas]ized.
+
+---
+// Error: 13 expected underscore
+#box[_Scoped] to body.
+
+---
+// Ends at paragraph break.
+// Error: 7 expected underscore
+_Hello
+
+World
+
+---
+// Error: 1:12 expected star
+// Error: 2:1 expected star
+_Cannot *be_ interleaved*
diff --git a/tests/typ/markup/emph.typ b/tests/typ/markup/emph.typ
deleted file mode 100644
index 77ac2c72..00000000
--- a/tests/typ/markup/emph.typ
+++ /dev/null
@@ -1,11 +0,0 @@
-// Test emphasis toggle.
-
----
-// Basic.
-_Emphasized!_
-
-// Inside of words.
-Partly em_phas_ized.
-
-// Scoped to body.
-#box[_Scoped] to body.
diff --git a/tests/typ/markup/escape.typ b/tests/typ/markup/escape.typ
index c039e0b7..87d2b83a 100644
--- a/tests/typ/markup/escape.typ
+++ b/tests/typ/markup/escape.typ
@@ -32,4 +32,4 @@ let f() , ; : | + - /= == 12 "string"
---
// Unterminated.
// Error: 6 expected closing brace
-\u{41*Bold*
+\u{41[*Bold*]
diff --git a/tests/typ/markup/strong.typ b/tests/typ/markup/strong.typ
deleted file mode 100644
index d396cc2d..00000000
--- a/tests/typ/markup/strong.typ
+++ /dev/null
@@ -1,11 +0,0 @@
-// Test strong toggle.
-
----
-// Basic.
-*Strong!*
-
-// Inside of words.
-Partly str*ength*ened.
-
-// Scoped to body.
-#box[*Scoped] to body.
diff --git a/tests/typ/style/set-toggle.typ b/tests/typ/style/set-toggle.typ
deleted file mode 100644
index 9f26bdf7..00000000
--- a/tests/typ/style/set-toggle.typ
+++ /dev/null
@@ -1,10 +0,0 @@
-// Test set rules for toggleable booleans.
-
----
-// Test toggling and untoggling.
-*AB_C*DE
-*_*
-
----
-// Test toggling and nested templates.
-*A[B*[_C]]D*E
diff --git a/tests/typ/style/wrap.typ b/tests/typ/style/wrap.typ
index 1ff3cc95..2fa7716e 100644
--- a/tests/typ/style/wrap.typ
+++ b/tests/typ/style/wrap.typ
@@ -16,7 +16,7 @@ in booklovers and the great fulfiller of human need.
---
// Test wrap in template.
-A [_B #wrap c in [*#c*]; C] D
+A [_B #wrap c in [*#c*]; C_] D
---
// Test wrap style precedence.
diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ
index 658c7fa6..09e23558 100644
--- a/tests/typ/text/bidi.typ
+++ b/tests/typ/text/bidi.typ
@@ -10,7 +10,7 @@
---
// Test that consecutive, embedded LTR runs stay LTR.
// Here, we have two runs: "A" and italic "B".
-#let content = [أنت A_B_مطرC]
+#let content = [أنت A#emph[B]مطرC]
#set text(serif, "Noto Sans Arabic")
#par(lang: "ar", content)
#par(lang: "de", content)
@@ -18,7 +18,7 @@
---
// Test that consecutive, embedded RTL runs stay RTL.
// Here, we have three runs: "גֶ", bold "שֶׁ", and "ם".
-#let content = [Aגֶ*שֶׁ*םB]
+#let content = [Aגֶ#strong[שֶׁ]םB]
#set text(serif, "Noto Serif Hebrew")
#par(lang: "he", content)
#par(lang: "de", content)
diff --git a/tests/typ/text/linebreaks.typ b/tests/typ/text/linebreaks.typ
index 5f886381..de99f5ed 100644
--- a/tests/typ/text/linebreaks.typ
+++ b/tests/typ/text/linebreaks.typ
@@ -10,7 +10,7 @@ Supercalifragilisticexpialidocious Expialigoricmetrioxidation.
---
// Test that there are no unwanted line break opportunities on run change.
-This is partly emp_has_ized.
+This is partly emp#emph[has]ized.
---
Hard \ break.
diff --git a/tests/typeset.rs b/tests/typeset.rs
index 5437860b..64749975 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -259,6 +259,8 @@ fn test_part(
debug: bool,
rng: &mut LinearShift,
) -> (bool, bool, Vec<Rc<Frame>>) {
+ let mut ok = true;
+
let id = ctx.sources.provide(src_path, src);
let source = ctx.sources.get(id);
if debug {
@@ -267,7 +269,8 @@ fn test_part(
let (local_compare_ref, mut ref_errors) = parse_metadata(&source);
let compare_ref = local_compare_ref.unwrap_or(compare_ref);
- let mut ok = test_reparse(ctx.sources.get(id).src(), i, rng);
+
+ ok &= test_reparse(ctx.sources.get(id).src(), i, rng);
let (frames, mut errors) = match ctx.evaluate(id) {
Ok(module) => {