@@ -65,8 +65,8 @@ fn main() {
65
65
66
66
let err = String :: from_utf8_lossy ( & result. stderr ) ;
67
67
68
- // the span should end the line (e.g no extra ^ 's)
69
- let expected_span = format ! ( "^{}\n " , repeat( "^ " ) . take( n - 1 )
68
+ // the span should end the line (e.g no extra ~ 's)
69
+ let expected_span = format ! ( "^{}\n " , repeat( "~ " ) . take( n - 1 )
70
70
. collect:: <String >( ) ) ;
71
71
assert ! ( err. contains( & expected_span) ) ;
72
72
}
@@ -91,19 +91,17 @@ fn main() {
91
91
92
92
// Test both the length of the snake and the leading spaces up to it
93
93
94
- // First snake is 9 ^s long.
95
- let expected_1 = r#"
96
- 1 |> extern "路濫狼á́́" fn foo() {} extern "路濫狼á́" fn bar() {}
97
- |> ^^^^^^^^^
98
- "# ;
99
- assert ! ( err. contains( & expected_1) ) ;
100
-
101
- // Second snake is only 8 ^s long, because rustc counts chars()
102
- // now rather than width(). This is because width() functions are
103
- // to be removed from librustc_unicode
104
- let expected_2 = r#"
105
- 1 |> extern "路濫狼á́́" fn foo() {} extern "路濫狼á́" fn bar() {}
106
- |> ^^^^^^^^
107
- "# ;
108
- assert ! ( err. contains( & expected_2) ) ;
94
+ // First snake is 8 ~s long, with 7 preceding spaces (excluding file name/line offset)
95
+ let expected_span = format ! ( "\n {}^{}\n " ,
96
+ repeat( " " ) . take( offset + 7 ) . collect:: <String >( ) ,
97
+ repeat( "~" ) . take( 8 ) . collect:: <String >( ) ) ;
98
+ assert ! ( err. contains( & expected_span) ) ;
99
+ // Second snake is only 7 ~s long, with 36 preceding spaces,
100
+ // because rustc counts chars() now rather than width(). This
101
+ // is because width() functions are to be removed from
102
+ // librustc_unicode
103
+ let expected_span = format ! ( "\n {}^{}\n " ,
104
+ repeat( " " ) . take( offset + 36 ) . collect:: <String >( ) ,
105
+ repeat( "~" ) . take( 7 ) . collect:: <String >( ) ) ;
106
+ assert ! ( err. contains( & expected_span) ) ;
109
107
}
0 commit comments