diff options
Diffstat (limited to 'tests/fixtures/no-color')
18 files changed, 307 insertions, 0 deletions
diff --git a/tests/fixtures/no-color/issue_9.toml b/tests/fixtures/no-color/issue_9.toml new file mode 100644 index 0000000..a30563b --- /dev/null +++ b/tests/fixtures/no-color/issue_9.toml @@ -0,0 +1,28 @@ +[title] +label = "expected one of `.`, `;`, `?`, or an operator, found `for`" +annotation_type = "Error" + +[[slices]] +source = "let x = vec![1];" +line_start = 4 +origin = "/code/rust/src/test/ui/annotate-snippet/suggestion.rs" +[[slices.annotations]] +label = "move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait" +annotation_type = "Warning" +range = [4, 5] + +[[slices]] +source = "let y = x;" +line_start = 7 +[[slices.annotations]] +label = "value moved here" +annotation_type = "Warning" +range = [8, 9] + +[[slices]] +source = "x;" +line_start = 9 +[[slices.annotations]] +label = "value used here after move" +annotation_type = "Error" +range = [0, 1] diff --git a/tests/fixtures/no-color/issue_9.txt b/tests/fixtures/no-color/issue_9.txt new file mode 100644 index 0000000..affe6bc --- /dev/null +++ b/tests/fixtures/no-color/issue_9.txt @@ -0,0 +1,12 @@ +error: expected one of `.`, `;`, `?`, or an operator, found `for` + --> /code/rust/src/test/ui/annotate-snippet/suggestion.rs:4:5 + | +4 | let x = vec![1]; + | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait + | +7 | let y = x; + | - value moved here + | +9 | x; + | ^ value used here after move + |
\ No newline at end of file diff --git a/tests/fixtures/no-color/multiline_annotation.toml b/tests/fixtures/no-color/multiline_annotation.toml new file mode 100644 index 0000000..c3dc1e9 --- /dev/null +++ b/tests/fixtures/no-color/multiline_annotation.toml @@ -0,0 +1,40 @@ +[[slices]] +source = """ +) -> Option<String> { + for ann in annotations { + match (ann.range.0, ann.range.1) { + (None, None) => continue, + (Some(start), Some(end)) if start > end_index || end < start_index => continue, + (Some(start), Some(end)) if start >= start_index && end <= end_index => { + let label = if let Some(ref label) = ann.label { + format!(" {}", label) + } else { + String::from("") + }; + + return Some(format!( + "{}{}{}", + " ".repeat(start - start_index), + "^".repeat(end - start), + label + )); + } + _ => continue, + } + } +""" +line_start = 51 +origin = "src/format.rs" +fold = true +[[slices.annotations]] +label = "expected `std::option::Option<std::string::String>` because of return type" +annotation_type = "Warning" +range = [5, 19] +[[slices.annotations]] +label = "expected enum `std::option::Option`, found ()" +annotation_type = "Error" +range = [22, 766] +[title] +label = "mismatched types" +id = "E0308" +annotation_type = "Error" diff --git a/tests/fixtures/no-color/multiline_annotation.txt b/tests/fixtures/no-color/multiline_annotation.txt new file mode 100644 index 0000000..bacdec1 --- /dev/null +++ b/tests/fixtures/no-color/multiline_annotation.txt @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> src/format.rs:51:6 + | +51 | ) -> Option<String> { + | -------------- expected `std::option::Option<std::string::String>` because of return type +52 | / for ann in annotations { +53 | | match (ann.range.0, ann.range.1) { +54 | | (None, None) => continue, +55 | | (Some(start), Some(end)) if start > end_index || end < start_index => continue, +... | +71 | | } +72 | | } + | |_____^ expected enum `std::option::Option`, found () + | diff --git a/tests/fixtures/no-color/multiline_annotation2.toml b/tests/fixtures/no-color/multiline_annotation2.toml new file mode 100644 index 0000000..845bf9f --- /dev/null +++ b/tests/fixtures/no-color/multiline_annotation2.toml @@ -0,0 +1,18 @@ +[[slices]] +source = """ + if let DisplayLine::Source { + ref mut inline_marks, + } = body[body_idx] +""" +line_start = 139 +origin = "src/display_list.rs" +fold = false +[[slices.annotations]] +label = "missing fields `lineno`, `content`" +annotation_type = "Error" +range = [31, 128] + +[title] +label = "pattern does not mention fields `lineno`, `content`" +id = "E0027" +annotation_type = "Error" diff --git a/tests/fixtures/no-color/multiline_annotation2.txt b/tests/fixtures/no-color/multiline_annotation2.txt new file mode 100644 index 0000000..8a00bfa --- /dev/null +++ b/tests/fixtures/no-color/multiline_annotation2.txt @@ -0,0 +1,9 @@ +error[E0027]: pattern does not mention fields `lineno`, `content` + --> src/display_list.rs:139:32 + | +139 | if let DisplayLine::Source { + | ________________________________^ +140 | | ref mut inline_marks, +141 | | } = body[body_idx] + | |_________________________^ missing fields `lineno`, `content` + | diff --git a/tests/fixtures/no-color/multiline_annotation3.toml b/tests/fixtures/no-color/multiline_annotation3.toml new file mode 100644 index 0000000..21bbcd8 --- /dev/null +++ b/tests/fixtures/no-color/multiline_annotation3.toml @@ -0,0 +1,18 @@ +[[slices]] +source = """ +This is an exampl +e of an edge case of an annotation overflowing +to exactly one character on next line. +""" +line_start = 26 +origin = "foo.txt" +fold = false +[[slices.annotations]] +label = "this should not be on separate lines" +annotation_type = "Error" +range = [11, 18] + +[title] +label = "spacing error found" +id = "E####" +annotation_type = "Error" diff --git a/tests/fixtures/no-color/multiline_annotation3.txt b/tests/fixtures/no-color/multiline_annotation3.txt new file mode 100644 index 0000000..12e174c --- /dev/null +++ b/tests/fixtures/no-color/multiline_annotation3.txt @@ -0,0 +1,9 @@ +error[E####]: spacing error found + --> foo.txt:26:12 + | +26 | This is an exampl + | ____________^ +27 | | e of an edge case of an annotation overflowing + | |_^ this should not be on separate lines +28 | to exactly one character on next line. + |
\ No newline at end of file diff --git a/tests/fixtures/no-color/multiple_annotations.toml b/tests/fixtures/no-color/multiple_annotations.toml new file mode 100644 index 0000000..84efc5f --- /dev/null +++ b/tests/fixtures/no-color/multiple_annotations.toml @@ -0,0 +1,25 @@ +[[slices]] +source = """ +fn add_title_line(result: &mut Vec<String>, main_annotation: Option<&Annotation>) { + if let Some(annotation) = main_annotation { + result.push(format_title_line( + &annotation.annotation_type, + None, + &annotation.label, + )); + } +} +""" +line_start = 96 +[[slices.annotations]] +label = "Variable defined here" +annotation_type = "Error" +range = [100, 110] +[[slices.annotations]] +label = "Referenced here" +annotation_type = "Error" +range = [184, 194] +[[slices.annotations]] +label = "Referenced again here" +annotation_type = "Error" +range = [243, 253] diff --git a/tests/fixtures/no-color/multiple_annotations.txt b/tests/fixtures/no-color/multiple_annotations.txt new file mode 100644 index 0000000..26c677f --- /dev/null +++ b/tests/fixtures/no-color/multiple_annotations.txt @@ -0,0 +1,14 @@ + | + 96 | fn add_title_line(result: &mut Vec<String>, main_annotation: Option<&Annotation>) { + 97 | if let Some(annotation) = main_annotation { + | ^^^^^^^^^^ Variable defined here + 98 | result.push(format_title_line( + 99 | &annotation.annotation_type, + | ^^^^^^^^^^ Referenced here +100 | None, +101 | &annotation.label, + | ^^^^^^^^^^ Referenced again here +102 | )); +103 | } +104 | } + | diff --git a/tests/fixtures/no-color/simple.toml b/tests/fixtures/no-color/simple.toml new file mode 100644 index 0000000..6c38674 --- /dev/null +++ b/tests/fixtures/no-color/simple.toml @@ -0,0 +1,18 @@ +[[slices]] +source = """ + }) + + for line in &self.body {""" +line_start = 169 +origin = "src/format_color.rs" +[[slices.annotations]] +label = "unexpected token" +annotation_type = "Error" +range = [20, 23] +[[slices.annotations]] +label = "expected one of `.`, `;`, `?`, or an operator here" +annotation_type = "Warning" +range = [10, 11] +[title] +label = "expected one of `.`, `;`, `?`, or an operator, found `for`" +annotation_type = "Error" diff --git a/tests/fixtures/no-color/simple.txt b/tests/fixtures/no-color/simple.txt new file mode 100644 index 0000000..752cc89 --- /dev/null +++ b/tests/fixtures/no-color/simple.txt @@ -0,0 +1,9 @@ +error: expected one of `.`, `;`, `?`, or an operator, found `for` + --> src/format_color.rs:171:9 + | +169 | }) + | - expected one of `.`, `;`, `?`, or an operator here +170 | +171 | for line in &self.body { + | ^^^ unexpected token + | diff --git a/tests/fixtures/no-color/strip_line.toml b/tests/fixtures/no-color/strip_line.toml new file mode 100644 index 0000000..76d9519 --- /dev/null +++ b/tests/fixtures/no-color/strip_line.toml @@ -0,0 +1,25 @@ +[title] +id = "E0308" +label = "mismatched types" +annotation_type = "Error" + +[[slices]] +source = " let _: () = 42;" +line_start = 4 +origin = "$DIR/whitespace-trimming.rs" + +[[slices.annotations]] +label = "expected (), found integer" +annotation_type = "Error" +range = [192, 194] + +[opt] +color = false +anonymized_line_numbers = true +[opt.margin] +whitespace_left = 180 +span_left = 192 +span_right = 194 +label_right = 221 +column_width = 140 +max_line_len = 195 diff --git a/tests/fixtures/no-color/strip_line.txt b/tests/fixtures/no-color/strip_line.txt new file mode 100644 index 0000000..65b0538 --- /dev/null +++ b/tests/fixtures/no-color/strip_line.txt @@ -0,0 +1,6 @@ +error[E0308]: mismatched types + --> $DIR/whitespace-trimming.rs:4:193 + | +LL | ... let _: () = 42; + | ^^ expected (), found integer + | diff --git a/tests/fixtures/no-color/strip_line_char.toml b/tests/fixtures/no-color/strip_line_char.toml new file mode 100644 index 0000000..5b432be --- /dev/null +++ b/tests/fixtures/no-color/strip_line_char.toml @@ -0,0 +1,25 @@ +[title] +id = "E0308" +label = "mismatched types" +annotation_type = "Error" + +[[slices]] +source = " let _: () = 42ñ" +line_start = 4 +origin = "$DIR/whitespace-trimming.rs" + +[[slices.annotations]] +label = "expected (), found integer" +annotation_type = "Error" +range = [192, 194] + +[opt] +color = false +anonymized_line_numbers = true +[opt.margin] +whitespace_left = 180 +span_left = 192 +span_right = 194 +label_right = 221 +column_width = 140 +max_line_len = 195 diff --git a/tests/fixtures/no-color/strip_line_char.txt b/tests/fixtures/no-color/strip_line_char.txt new file mode 100644 index 0000000..3d4b700 --- /dev/null +++ b/tests/fixtures/no-color/strip_line_char.txt @@ -0,0 +1,6 @@ +error[E0308]: mismatched types + --> $DIR/whitespace-trimming.rs:4:193 + | +LL | ... let _: () = 42ñ + | ^^ expected (), found integer + | diff --git a/tests/fixtures/no-color/strip_line_non_ws.toml b/tests/fixtures/no-color/strip_line_non_ws.toml new file mode 100644 index 0000000..5129f5c --- /dev/null +++ b/tests/fixtures/no-color/strip_line_non_ws.toml @@ -0,0 +1,25 @@ +[title] +id = "E0308" +label = "mismatched types" +annotation_type = "Error" + +[[slices]] +source = " let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ();" +line_start = 4 +origin = "$DIR/non-whitespace-trimming.rs" + +[[slices.annotations]] +label = "expected (), found integer" +annotation_type = "Error" +range = [240, 242] + +[opt] +color = false +anonymized_line_numbers = true +[opt.margin] +whitespace_left = 4 +span_left = 240 +span_right = 242 +label_right = 271 +column_width = 140 +max_line_len = 371 diff --git a/tests/fixtures/no-color/strip_line_non_ws.txt b/tests/fixtures/no-color/strip_line_non_ws.txt new file mode 100644 index 0000000..850619a --- /dev/null +++ b/tests/fixtures/no-color/strip_line_non_ws.txt @@ -0,0 +1,6 @@ +error[E0308]: mismatched types + --> $DIR/non-whitespace-trimming.rs:4:241 + | +LL | ... = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ();... + | ^^ expected (), found integer + | |