summaryrefslogtreecommitdiff
path: root/src/syntax/node.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-26 21:57:56 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-26 21:57:56 +0100
commit010ddc4795123987bdef3b5a60240203e7f11d01 (patch)
treefa27e7def6d229ba1347ab2cb7d2d06462f46613 /src/syntax/node.rs
parentf006636dd2af065a149e3aa1d67fcbe889c53b87 (diff)
More straightforward pretty printing tests 🧹
Diffstat (limited to 'src/syntax/node.rs')
-rw-r--r--src/syntax/node.rs36
1 files changed, 3 insertions, 33 deletions
diff --git a/src/syntax/node.rs b/src/syntax/node.rs
index 5c4c22b7..db3b6510 100644
--- a/src/syntax/node.rs
+++ b/src/syntax/node.rs
@@ -150,40 +150,10 @@ impl Pretty for NodeRaw {
p.push_str(&lang);
p.push_str(" ");
}
- // TODO: Technically, we should handle backticks in the lines
- // by wrapping with more backticks and possibly adding space
- // before the first or after the last line.
+ // TODO: Technically, we should handle backticks in the lines by
+ // wrapping with more backticks, and we should add space before the
+ // first and/or after the last line if necessary.
p.join(&self.lines, "\n", |line, p| p.push_str(line));
p.push_str("`");
}
}
-
-#[cfg(test)]
-mod tests {
- use super::super::tests::test_pretty;
-
- #[test]
- fn test_pretty_print_bracket_calls() {
- // Top-level call expression formatted as bracket call.
- test_pretty("[v]", "[v]");
-
- // Blocks are preserved.
- test_pretty("{v()}", "{v()}");
- test_pretty("{[[v]]}", "{[[v]]}");
- }
-
- #[test]
- fn test_pretty_print_nodes() {
- // Basic text and markup.
- test_pretty(r"*Hi_\", r"*Hi_\");
-
- // Whitespace.
- test_pretty(" ", " ");
- test_pretty("\n\n\n", "\n\n");
-
- // Heading and raw.
- test_pretty("# Ok", "# Ok");
- test_pretty("``\none\ntwo\n``", "`one\ntwo`");
- test_pretty("`lang one\ntwo`", "`lang one\ntwo`");
- }
-}