diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-11 14:39:52 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-07 13:59:13 +0100 |
| commit | 27f97aa468b5079bfd159e6fee9a04d5501a8818 (patch) | |
| tree | 014c6f7ebc01fdde85bbd4d12d10e74a377d6f36 /src/libsyntax/util/comments | |
| parent | a1571b68552b0d56d85080c5f92fdab233775de4 (diff) | |
| download | rust-27f97aa468b5079bfd159e6fee9a04d5501a8818.tar.gz rust-27f97aa468b5079bfd159e6fee9a04d5501a8818.zip | |
move syntax::parse::lexer::comments -> syntax::util::comments
Diffstat (limited to 'src/libsyntax/util/comments')
| -rw-r--r-- | src/libsyntax/util/comments/tests.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/libsyntax/util/comments/tests.rs b/src/libsyntax/util/comments/tests.rs new file mode 100644 index 00000000000..f9cd69fb50d --- /dev/null +++ b/src/libsyntax/util/comments/tests.rs @@ -0,0 +1,47 @@ +use super::*; + +#[test] +fn test_block_doc_comment_1() { + let comment = "/**\n * Test \n ** Test\n * Test\n*/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " Test \n* Test\n Test"); +} + +#[test] +fn test_block_doc_comment_2() { + let comment = "/**\n * Test\n * Test\n*/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " Test\n Test"); +} + +#[test] +fn test_block_doc_comment_3() { + let comment = "/**\n let a: *i32;\n *a = 5;\n*/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " let a: *i32;\n *a = 5;"); +} + +#[test] +fn test_block_doc_comment_4() { + let comment = "/*******************\n test\n *********************/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " test"); +} + +#[test] +fn test_line_doc_comment() { + let stripped = strip_doc_comment_decoration("/// test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("///! test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("// test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("// test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("///test"); + assert_eq!(stripped, "test"); + let stripped = strip_doc_comment_decoration("///!test"); + assert_eq!(stripped, "test"); + let stripped = strip_doc_comment_decoration("//test"); + assert_eq!(stripped, "test"); +} |
