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 {
200200}
201201
202202fn longest_backtick_sequence_length ( text : & str ) -> usize {
203+ let mut result = 0 ;
203204 let mut count = 0 ;
204205 for c in text. chars ( ) {
205206 if c == '`' {
206207 count += 1 ;
207208 } else {
209+ if count > result {
210+ result = count;
211+ }
208212 count = 0 ;
209213 }
210214 }
211- count
215+ result
212216}
213217impl DiagnosticMessage {
214218 pub fn full_error_message ( & self ) -> String {
@@ -326,7 +330,10 @@ fn test_message() {
326330 let mut m = DiagnosticLoggers :: new ( "foo" )
327331 . logger ( )
328332 . 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+ ) ;
332339}
You can’t perform that action at this time.
0 commit comments