summaryrefslogtreecommitdiff
path: root/tests/typ/markup
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-20 17:53:40 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-20 23:34:33 +0100
commit05727bfc3a9cfd45a8e2028dfd0806f7a8f88015 (patch)
tree6c0b66eb2a9dff224cb39eb6ccb478656a706c04 /tests/typ/markup
parent927341d93ae29678095e3b874bd68bfc57d4bc05 (diff)
Reorganize tests 🔀
Diffstat (limited to 'tests/typ/markup')
-rw-r--r--tests/typ/markup/emph.typ14
-rw-r--r--tests/typ/markup/escape.typ30
-rw-r--r--tests/typ/markup/heading.typ44
-rw-r--r--tests/typ/markup/linebreak.typ23
-rw-r--r--tests/typ/markup/nbsp.typ5
-rw-r--r--tests/typ/markup/raw.typ51
-rw-r--r--tests/typ/markup/strong.typ14
7 files changed, 181 insertions, 0 deletions
diff --git a/tests/typ/markup/emph.typ b/tests/typ/markup/emph.typ
new file mode 100644
index 00000000..772e15ab
--- /dev/null
+++ b/tests/typ/markup/emph.typ
@@ -0,0 +1,14 @@
+// Test emphasis toggle.
+
+---
+// Basic.
+_Emphasized!_
+
+// Inside of words.
+Partly em_phas_ized.
+
+// Scoped to body.
+#box[_Scoped] to body.
+
+// Unterminated is fine.
+_The End
diff --git a/tests/typ/markup/escape.typ b/tests/typ/markup/escape.typ
new file mode 100644
index 00000000..eeac4997
--- /dev/null
+++ b/tests/typ/markup/escape.typ
@@ -0,0 +1,30 @@
+// Test escape sequences.
+
+---
+// Escapable symbols.
+\\ \/ \[ \] \{ \} \# \* \_ \= \~ \` \$
+
+// No need to escape.
+( ) ; < >
+
+// Unescapable.
+\a \: \; \( \)
+
+// Escaped comments.
+\//
+\/\* \*\/
+\/* \*/ *
+
+// Unicode escape sequence.
+\u{1F3D5} == 🏕
+
+// Escaped escape sequence.
+\u{41} vs. \\u\{41\}
+
+// Unicode codepoint does not exist.
+// Error: 1-11 invalid unicode escape sequence
+\u{FFFFFF}
+
+// Unterminated.
+// Error: 6 expected closing brace
+\u{41*Bold*
diff --git a/tests/typ/markup/heading.typ b/tests/typ/markup/heading.typ
new file mode 100644
index 00000000..8497ec8f
--- /dev/null
+++ b/tests/typ/markup/heading.typ
@@ -0,0 +1,44 @@
+// Test headings.
+
+---
+// Different number of hashtags.
+
+// Valid levels.
+=1
+===2
+======6
+
+// Too many hashtags.
+// Warning: 1-8 should not exceed depth 6
+=======7
+
+---
+// Heading continuation over linebreak.
+
+// Code blocks continue heading.
+= A{
+ "B"
+}
+
+// Function call continues heading.
+= #box[
+ A
+] B
+
+// Without some kind of block, headings end at a line break.
+= A
+B
+
+---
+// Heading vs. no heading.
+
+// Parsed as headings if at start of the context.
+/**/ = Ok
+{[== Ok]}
+#box[=== Ok]
+
+// Not at the start of the context.
+No = heading
+
+// Escaped.
+\= No heading
diff --git a/tests/typ/markup/linebreak.typ b/tests/typ/markup/linebreak.typ
new file mode 100644
index 00000000..e6392992
--- /dev/null
+++ b/tests/typ/markup/linebreak.typ
@@ -0,0 +1,23 @@
+// Test forced line breaks.
+
+---
+// Directly after word.
+Line\ Break
+
+// Spaces around.
+Line \ Break
+
+// Directly before word does not work.
+No \Break
+
+---
+// Leading line break.
+\ Leading
+
+// Trailing before paragraph break.
+Trailing 1 \
+
+Trailing 2
+
+// Trailing before end of document.
+Trailing 3 \
diff --git a/tests/typ/markup/nbsp.typ b/tests/typ/markup/nbsp.typ
new file mode 100644
index 00000000..5af6c84f
--- /dev/null
+++ b/tests/typ/markup/nbsp.typ
@@ -0,0 +1,5 @@
+// Test the non breaking space.
+
+---
+// Parsed correctly, but not actually doing anything at the moment.
+The non-breaking~space does not work.
diff --git a/tests/typ/markup/raw.typ b/tests/typ/markup/raw.typ
new file mode 100644
index 00000000..f5074c8e
--- /dev/null
+++ b/tests/typ/markup/raw.typ
@@ -0,0 +1,51 @@
+// Test raw blocks.
+
+---
+// No extra space.
+`A``B`
+
+---
+// Typst syntax inside.
+`#let x = 1` \
+`#[f 1]`
+
+---
+// Multiline block splits paragraphs.
+
+First
+```
+Second
+```
+Third
+
+---
+// Lots of backticks inside.
+````
+```backticks```
+````
+
+---
+// Trimming.
+
+// Space between "rust" and "let" is trimmed.
+The keyword ```rust let```.
+
+// Trimming depends on number backticks.
+<``> \
+<` untrimmed `> \
+<``` trimmed` ```> \
+<``` trimmed ```> \
+<``` trimmed```>
+
+// Multiline trimming.
+```py
+import this
+
+def hi():
+ print("Hi!")
+```
+
+---
+// Unterminated.
+// Error: 2:1 expected backtick(s)
+`endless
diff --git a/tests/typ/markup/strong.typ b/tests/typ/markup/strong.typ
new file mode 100644
index 00000000..b02a55a5
--- /dev/null
+++ b/tests/typ/markup/strong.typ
@@ -0,0 +1,14 @@
+// Test strong toggle.
+
+---
+// Basic.
+*Strong!*
+
+// Inside of words.
+Partly str*ength*ened.
+
+// Scoped to body.
+#box[*Scoped] to body.
+
+// Unterminated is fine.
+*The End