From 010ddc4795123987bdef3b5a60240203e7f11d01 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 26 Jan 2021 21:57:56 +0100 Subject: =?UTF-8?q?More=20straightforward=20pretty=20printing=20tests=20?= =?UTF-8?q?=F0=9F=A7=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/node.rs | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'src/syntax/node.rs') 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`"); - } -} -- cgit v1.2.3