about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-04-20 17:47:42 -0400
committerNiko Matsakis <niko@alum.mit.edu>2016-05-02 11:49:24 -0400
commit9d022f299359c341d2f57ab5425855556fc83937 (patch)
treeb241e692435deb8b7398ba14b3c0327cf9074efd /src
parent47143945cc3bc8ec67f67609df13ccd4bb1a3bf5 (diff)
rewrite span-length to include strings
It is way easier to copy-and-paste strings from the output
than to figure out how to reproduce them from first
principles.
Diffstat (limited to 'src')
-rw-r--r--src/test/run-make/unicode-input/span_length.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/test/run-make/unicode-input/span_length.rs b/src/test/run-make/unicode-input/span_length.rs
index 3963d20df88..f3bfe083016 100644
--- a/src/test/run-make/unicode-input/span_length.rs
+++ b/src/test/run-make/unicode-input/span_length.rs
@@ -65,8 +65,8 @@ fn main() {
 
         let err = String::from_utf8_lossy(&result.stderr);
 
-        // the span should end the line (e.g no extra ~'s)
-        let expected_span = format!("^{}\n", repeat("~").take(n - 1)
+        // the span should end the line (e.g no extra ^'s)
+        let expected_span = format!("^{}\n", repeat("^").take(n - 1)
                                                         .collect::<String>());
         assert!(err.contains(&expected_span));
     }
@@ -91,17 +91,19 @@ fn main() {
 
     // Test both the length of the snake and the leading spaces up to it
 
-    // First snake is 8 ~s long, with 7 preceding spaces (excluding file name/line offset)
-    let expected_span = format!("\n{}^{}\n",
-                                repeat(" ").take(offset + 7).collect::<String>(),
-                                repeat("~").take(8).collect::<String>());
-    assert!(err.contains(&expected_span));
-    // Second snake is only 7 ~s long, with 36 preceding spaces,
-    // because rustc counts chars() now rather than width(). This
-    // is because width() functions are to be removed from
-    // librustc_unicode
-    let expected_span = format!("\n{}^{}\n",
-                                repeat(" ").take(offset + 36).collect::<String>(),
-                                repeat("~").take(7).collect::<String>());
-    assert!(err.contains(&expected_span));
+    // First snake is 9 ^s long.
+    let expected_1 = r#"
+1 |> extern "路濫狼á́́" fn foo() {} extern "路濫狼á́" fn bar() {}
+  |>        ^^^^^^^^^
+"#;
+    assert!(err.contains(&expected_1));
+
+    // Second snake is only 8 ^s long, because rustc counts chars()
+    // now rather than width(). This is because width() functions are
+    // to be removed from librustc_unicode
+    let expected_2 = r#"
+1 |> extern "路濫狼á́́" fn foo() {} extern "路濫狼á́" fn bar() {}
+  |>                                     ^^^^^^^^
+"#;
+    assert!(err.contains(&expected_2));
 }