summaryrefslogtreecommitdiff
path: root/tests/suite
diff options
context:
space:
mode:
authorIan Wrzesinski <133046678+wrzian@users.noreply.github.com>2024-12-11 06:31:04 -0500
committerGitHub <noreply@github.com>2024-12-11 11:31:04 +0000
commitef4fc040b279104f6c95a5ea2f9a9d10fb0e9019 (patch)
treeb961000d21d460dc9048088bf4b62acba84bd235 /tests/suite
parenta5ade167dd24fe3efdb3391dcb72a09b4dd1a268 (diff)
Improve raw trimming (#5541)
Diffstat (limited to 'tests/suite')
-rw-r--r--tests/suite/text/raw.typ55
1 files changed, 54 insertions, 1 deletions
diff --git a/tests/suite/text/raw.typ b/tests/suite/text/raw.typ
index fa9e630f..1ba21630 100644
--- a/tests/suite/text/raw.typ
+++ b/tests/suite/text/raw.typ
@@ -282,10 +282,40 @@ int main() {
--- raw-blocky ---
// Test various raw parsing edge cases.
+
#let empty = (
name: "empty",
input: ``,
text: "",
+ block: false,
+)
+
+#let empty-spaces = (
+ name: "empty-spaces",
+ input: ``` ```,
+ text: "",
+ block: false,
+)
+
+#let empty-newlines = (
+ name: "empty-newlines",
+ input: ```
+
+
+```,
+ text: "\n",
+ block: true,
+)
+
+#let newlines-backtick = (
+ name: "newlines-backtick",
+ input: ```
+
+`
+
+```,
+ text: "\n`\n",
+ block: true,
)
#let backtick = (
@@ -423,8 +453,18 @@ test
block: true,
)
+#let extra-first-line-ws = (
+ name: "extra-first-line-ws",
+ input: eval("``` \n```"),
+ text: "",
+ block: true,
+)
+
#let cases = (
empty,
+ empty-spaces,
+ empty-newlines,
+ newlines-backtick,
backtick,
lang-backtick,
lang-space,
@@ -438,10 +478,11 @@ test
blocky-dedent-lastline2,
blocky-tab,
blocky-tab-dedent,
+ extra-first-line-ws,
)
#for c in cases {
- let block = c.at("block", default: false)
+ let block = c.block
assert.eq(c.text, c.input.text, message: "in point " + c.name + ", expect " + repr(c.text) + ", got " + repr(c.input.text) + "")
assert.eq(block, c.input.block, message: "in point " + c.name + ", expect " + repr(block) + ", got " + repr(c.input.block) + "")
}
@@ -558,6 +599,18 @@ print(y)
```typ
```
+--- raw-empty-lines ---
+// Test raw with multiple empty lines.
+
+#show raw: block.with(width: 100%, fill: gray)
+
+```
+
+
+
+
+```
+
--- issue-3841-tabs-in-raw-type-code ---
// Tab chars were not rendered in raw blocks with lang: "typ(c)"
#raw("#if true {\n\tf()\t// typ\n}", lang: "typ")