@@ -82,11 +82,13 @@ fn multi_line_formatting() {
82
82
let error = SuperError { source : SuperErrorSideKick } ;
83
83
let report = Report :: new ( & error) . pretty ( true ) ;
84
84
let actual = report. to_string ( ) ;
85
- let expected = String :: from ( "\
85
+ let expected = String :: from (
86
+ "\
86
87
SuperError is here!
87
88
88
89
Caused by:
89
- SuperErrorSideKick is here!" ) ;
90
+ SuperErrorSideKick is here!" ,
91
+ ) ;
90
92
91
93
assert_eq ! ( expected, actual) ;
92
94
}
@@ -112,43 +114,47 @@ fn error_with_no_sources_formats_multi_line_correctly() {
112
114
#[ test]
113
115
fn error_with_backtrace_outputs_correctly_with_one_source ( ) {
114
116
let trace = Backtrace :: force_capture ( ) ;
115
- let expected = format ! ( "\
117
+ let expected = format ! (
118
+ "\
116
119
The source of the error
117
120
118
121
Caused by:
119
122
Error with backtrace
120
123
121
124
Stack backtrace:
122
- {}" , trace) ;
125
+ {}" ,
126
+ trace
127
+ ) ;
123
128
let error = GenericError :: new ( "Error with backtrace" ) ;
124
129
let mut error = GenericError :: new_with_source ( "The source of the error" , error) ;
125
130
error. backtrace = Some ( trace) ;
126
131
let report = Report :: new ( error) . pretty ( true ) . show_backtrace ( true ) ;
127
132
128
-
129
133
println ! ( "Error: {}" , report) ;
130
134
assert_eq ! ( expected. trim_end( ) , report. to_string( ) ) ;
131
135
}
132
136
133
137
#[ test]
134
138
fn error_with_backtrace_outputs_correctly_with_two_sources ( ) {
135
139
let trace = Backtrace :: force_capture ( ) ;
136
- let expected = format ! ( "\
140
+ let expected = format ! (
141
+ "\
137
142
Error with two sources
138
143
139
144
Caused by:
140
145
0: The source of the error
141
146
1: Error with backtrace
142
147
143
148
Stack backtrace:
144
- {}" , trace) ;
149
+ {}" ,
150
+ trace
151
+ ) ;
145
152
let mut error = GenericError :: new ( "Error with backtrace" ) ;
146
153
error. backtrace = Some ( trace) ;
147
154
let error = GenericError :: new_with_source ( "The source of the error" , error) ;
148
155
let error = GenericError :: new_with_source ( "Error with two sources" , error) ;
149
156
let report = Report :: new ( error) . pretty ( true ) . show_backtrace ( true ) ;
150
157
151
-
152
158
println ! ( "Error: {}" , report) ;
153
159
assert_eq ! ( expected. trim_end( ) , report. to_string( ) ) ;
154
160
}
@@ -313,11 +319,11 @@ The message
313
319
314
320
315
321
Caused by:
316
- 0:
317
- The message
318
-
319
- 1:
320
- The message
322
+ 0: \
323
+ \n The message
324
+ \
325
+ \n 1: \
326
+ \n The message
321
327
" ;
322
328
323
329
let actual = report. to_string ( ) ;
@@ -399,11 +405,11 @@ line 2
399
405
400
406
Caused by:
401
407
0: line 1
402
-
403
- line 2
408
+ \
409
+ \n line 2
404
410
1: line 1
405
-
406
- line 2" ;
411
+ \
412
+ \n line 2";
407
413
408
414
let actual = report. to_string ( ) ;
409
415
assert_eq ! ( expected, actual) ;
0 commit comments