From 0f5563c5366d5bad7ddece47708e82bc0c3e65ee Mon Sep 17 00:00:00 2001 From: marceloll Date: Wed, 6 Jan 2021 10:18:59 -0300 Subject: [PATCH] Add test for ; comments --- cli/src/test.rs | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/cli/src/test.rs b/cli/src/test.rs index ffaf6635..ca07fb07 100644 --- a/cli/src/test.rs +++ b/cli/src/test.rs @@ -590,4 +590,54 @@ output 2 .to_string() ); } + + #[test] + fn test_parse_test_content_with_comments_in_sexp() { + let entry = parse_test_content( + "the-filename".to_string(), + r#" +================== +Code with comment +================== +code +--- + +; Line start comment +(a (b)) + +========================= +Code line ending with comment +========================= +code +--- + +(c (d)) ; Line end comment + "# + .trim() + .to_string(), + None, + ); + + assert_eq!( + entry, + TestEntry::Group { + name: "the-filename".to_string(), + children: vec![ + TestEntry::Example { + name: "Code with comment".to_string(), + input: "code".as_bytes().to_vec(), + output: "(a (b))".to_string(), + has_fields: false, + }, + TestEntry::Example { + name: "Code line ending with comment".to_string(), + input: "code".as_bytes().to_vec(), + output: "(c (d))".to_string(), + has_fields: false, + }, + ], + file_path: None, + } + ); + } }