From 92f5ca64ae09ab996e83acb4017e355437eddc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Thu, 11 Oct 2018 17:11:00 +0200 Subject: Add tests --- crates/ra_editor/src/typing.rs | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'crates/ra_editor') diff --git a/crates/ra_editor/src/typing.rs b/crates/ra_editor/src/typing.rs index 3ebdf153e..97ff01e40 100644 --- a/crates/ra_editor/src/typing.rs +++ b/crates/ra_editor/src/typing.rs @@ -313,6 +313,62 @@ fn foo() { }"); } + #[test] + fn test_join_lines_normal_comments() { + check_join_lines(r" +fn foo() { + // Hello<|> + // world! +} +", r" +fn foo() { + // Hello<|> world! +} +"); + } + + #[test] + fn test_join_lines_doc_comments() { + check_join_lines(r" +fn foo() { + /// Hello<|> + /// world! +} +", r" +fn foo() { + /// Hello<|> world! +} +"); + } + + #[test] + fn test_join_lines_mod_comments() { + check_join_lines(r" +fn foo() { + //! Hello<|> + //! world! +} +", r" +fn foo() { + //! Hello<|> world! +} +"); + } + + #[test] + fn test_join_lines_multiline_comments() { + check_join_lines(r" +fn foo() { + // Hello<|> + /* world! */ +} +", r" +fn foo() { + // Hello<|> world! */ +} +"); + } + fn check_join_lines_sel(before: &str, after: &str) { let (sel, before) = extract_range(before); let file = File::parse(&before); -- cgit v1.2.3