about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/json/tests.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-22 19:05:04 -0400
committerMichael Goulet <michael@errs.io>2024-09-22 19:11:29 -0400
commitc682aa162b0d41e21cc6748f4fecfe01efb69d1f (patch)
tree0c31b640e3faacfb187a1509e3da5d5b6ba0109c /compiler/rustc_errors/src/json/tests.rs
parent1173204b364841b51598744fc69d7c80be10f956 (diff)
downloadrust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.tar.gz
rust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.zip
Reformat using the new identifier sorting from rustfmt
Diffstat (limited to 'compiler/rustc_errors/src/json/tests.rs')
-rw-r--r--compiler/rustc_errors/src/json/tests.rs162
1 files changed, 65 insertions, 97 deletions
diff --git a/compiler/rustc_errors/src/json/tests.rs b/compiler/rustc_errors/src/json/tests.rs
index 6af376d7afd..0de555b83d3 100644
--- a/compiler/rustc_errors/src/json/tests.rs
+++ b/compiler/rustc_errors/src/json/tests.rs
@@ -1,7 +1,7 @@
 use std::str;
 
-use rustc_span::source_map::FilePathMapping;
 use rustc_span::BytePos;
+use rustc_span::source_map::FilePathMapping;
 use serde::Deserialize;
 
 use super::*;
@@ -69,128 +69,96 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
 
 #[test]
 fn empty() {
-    test_positions(
-        " ",
-        (0, 1),
-        SpanTestData {
-            byte_start: 0,
-            byte_end: 1,
-            line_start: 1,
-            column_start: 1,
-            line_end: 1,
-            column_end: 2,
-        },
-    )
+    test_positions(" ", (0, 1), SpanTestData {
+        byte_start: 0,
+        byte_end: 1,
+        line_start: 1,
+        column_start: 1,
+        line_end: 1,
+        column_end: 2,
+    })
 }
 
 #[test]
 fn bom() {
-    test_positions(
-        "\u{feff} ",
-        (0, 1),
-        SpanTestData {
-            byte_start: 3,
-            byte_end: 4,
-            line_start: 1,
-            column_start: 1,
-            line_end: 1,
-            column_end: 2,
-        },
-    )
+    test_positions("\u{feff} ", (0, 1), SpanTestData {
+        byte_start: 3,
+        byte_end: 4,
+        line_start: 1,
+        column_start: 1,
+        line_end: 1,
+        column_end: 2,
+    })
 }
 
 #[test]
 fn lf_newlines() {
-    test_positions(
-        "\nmod foo;\nmod bar;\n",
-        (5, 12),
-        SpanTestData {
-            byte_start: 5,
-            byte_end: 12,
-            line_start: 2,
-            column_start: 5,
-            line_end: 3,
-            column_end: 3,
-        },
-    )
+    test_positions("\nmod foo;\nmod bar;\n", (5, 12), SpanTestData {
+        byte_start: 5,
+        byte_end: 12,
+        line_start: 2,
+        column_start: 5,
+        line_end: 3,
+        column_end: 3,
+    })
 }
 
 #[test]
 fn crlf_newlines() {
-    test_positions(
-        "\r\nmod foo;\r\nmod bar;\r\n",
-        (5, 12),
-        SpanTestData {
-            byte_start: 6,
-            byte_end: 14,
-            line_start: 2,
-            column_start: 5,
-            line_end: 3,
-            column_end: 3,
-        },
-    )
+    test_positions("\r\nmod foo;\r\nmod bar;\r\n", (5, 12), SpanTestData {
+        byte_start: 6,
+        byte_end: 14,
+        line_start: 2,
+        column_start: 5,
+        line_end: 3,
+        column_end: 3,
+    })
 }
 
 #[test]
 fn crlf_newlines_with_bom() {
-    test_positions(
-        "\u{feff}\r\nmod foo;\r\nmod bar;\r\n",
-        (5, 12),
-        SpanTestData {
-            byte_start: 9,
-            byte_end: 17,
-            line_start: 2,
-            column_start: 5,
-            line_end: 3,
-            column_end: 3,
-        },
-    )
+    test_positions("\u{feff}\r\nmod foo;\r\nmod bar;\r\n", (5, 12), SpanTestData {
+        byte_start: 9,
+        byte_end: 17,
+        line_start: 2,
+        column_start: 5,
+        line_end: 3,
+        column_end: 3,
+    })
 }
 
 #[test]
 fn span_before_crlf() {
-    test_positions(
-        "foo\r\nbar",
-        (2, 3),
-        SpanTestData {
-            byte_start: 2,
-            byte_end: 3,
-            line_start: 1,
-            column_start: 3,
-            line_end: 1,
-            column_end: 4,
-        },
-    )
+    test_positions("foo\r\nbar", (2, 3), SpanTestData {
+        byte_start: 2,
+        byte_end: 3,
+        line_start: 1,
+        column_start: 3,
+        line_end: 1,
+        column_end: 4,
+    })
 }
 
 #[test]
 fn span_on_crlf() {
-    test_positions(
-        "foo\r\nbar",
-        (3, 4),
-        SpanTestData {
-            byte_start: 3,
-            byte_end: 5,
-            line_start: 1,
-            column_start: 4,
-            line_end: 2,
-            column_end: 1,
-        },
-    )
+    test_positions("foo\r\nbar", (3, 4), SpanTestData {
+        byte_start: 3,
+        byte_end: 5,
+        line_start: 1,
+        column_start: 4,
+        line_end: 2,
+        column_end: 1,
+    })
 }
 
 #[test]
 fn span_after_crlf() {
-    test_positions(
-        "foo\r\nbar",
-        (4, 5),
-        SpanTestData {
-            byte_start: 5,
-            byte_end: 6,
-            line_start: 2,
-            column_start: 1,
-            line_end: 2,
-            column_end: 2,
-        },
-    )
+    test_positions("foo\r\nbar", (4, 5), SpanTestData {
+        byte_start: 5,
+        byte_end: 6,
+        line_start: 2,
+        column_start: 1,
+        line_end: 2,
+        column_end: 2,
+    })
 }