aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_spans.rs47
1 files changed, 45 insertions, 2 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs
index 09f10f4..e856a19 100644
--- a/tests/test_spans.rs
+++ b/tests/test_spans.rs
@@ -202,13 +202,24 @@ fn comment_data_span() {
#[rustfmt::skip]
let cases = [
"<!-- Why are you looking at the source code? -->",
+ "<!-- Why are you looking at the source code? --",
+ "<!-- Why are you looking at the source code? -",
+ "<!-- Why are you looking at the source code?",
+ "<!--",
+ "<!-->",
+ "<!---",
+ "<!--->",
+ "<!-- Why are you looking at the source code? ->",
+ "<!-- Why are you looking at the source code? --!>",
+ "<!-- Why are you looking at the source code? --!",
// bogus comments
"<! Why are you looking at the source code? -->",
+ "<!",
];
let mut annotated = String::new();
- for case in cases {
+ for (idx, case) in cases.iter().enumerate() {
let labeler = |tokens: TokenIter| {
let Token::Comment(comment) = tokens
.filter(|t| !matches!(t, Token::Error { .. }))
@@ -219,15 +230,47 @@ fn comment_data_span() {
};
vec![(comment.data_span(), "")]
};
- assert_panics_but_should_not(|| assert_char_encoding_independence(case, labeler)); // FIXME
+
+ println!("{idx}");
+ if [
+ 0, 1, 2, 3, 8, 9, 10, 11, // FIXME
+ ]
+ .contains(&idx)
+ {
+ assert_panics_but_should_not(|| assert_char_encoding_independence(case, labeler));
+ } else {
+ assert_char_encoding_independence(case, labeler);
+ }
annotated.push_str(&test_and_annotate(case, labeler));
}
assert_snapshot!(annotated, @r###"
<!-- Why are you looking at the source code? -->
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ <!-- Why are you looking at the source code? --
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ <!-- Why are you looking at the source code? -
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ <!-- Why are you looking at the source code?
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ <!--
+ ^
+ <!-->
+ ^
+ <!---
+ ^
+ <!--->
+ ^
+ <!-- Why are you looking at the source code? ->
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ <!-- Why are you looking at the source code? --!>
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ <!-- Why are you looking at the source code? --!
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<! Why are you looking at the source code? -->
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ <!
+ ^
"###);
for (idx, case) in cases.iter().enumerate() {