File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -200,15 +200,19 @@ impl DiagnosticLoggers {
200
200
}
201
201
202
202
fn longest_backtick_sequence_length ( text : & str ) -> usize {
203
+ let mut result = 0 ;
203
204
let mut count = 0 ;
204
205
for c in text. chars ( ) {
205
206
if c == '`' {
206
207
count += 1 ;
207
208
} else {
209
+ if count > result {
210
+ result = count;
211
+ }
208
212
count = 0 ;
209
213
}
210
214
}
211
- count
215
+ result
212
216
}
213
217
impl DiagnosticMessage {
214
218
pub fn full_error_message ( & self ) -> String {
@@ -326,7 +330,10 @@ fn test_message() {
326
330
let mut m = DiagnosticLoggers :: new ( "foo" )
327
331
. logger ( )
328
332
. new_entry ( "id" , "name" ) ;
329
- m. message ( "hello with backticks: {}" , & [ "`hello`" ] ) ;
330
- assert_eq ! ( "hello with backticks: `hello`" , m. plaintext_message) ;
331
- assert_eq ! ( "hello with backticks: `` `hello` ``" , m. markdown_message) ;
333
+ m. message ( "hello with backticks: {}" , & [ "oh `hello`!" ] ) ;
334
+ assert_eq ! ( "hello with backticks: oh `hello`!" , m. plaintext_message) ;
335
+ assert_eq ! (
336
+ "hello with backticks: `` oh `hello`! ``" ,
337
+ m. markdown_message
338
+ ) ;
332
339
}
You can’t perform that action at this time.
0 commit comments