@@ -1071,6 +1071,30 @@ mod tests {
10711071 "### ) ;
10721072 }
10731073
1074+ #[ test]
1075+ fn two_labels_without_messages_on_different_lines ( ) {
1076+ let source = "apple\n == orange;" ;
1077+ let msg = remove_trailing (
1078+ Report :: build ( ReportKind :: Error , 0 ..0 )
1079+ . with_config ( no_color_and_ascii ( ) )
1080+ . with_message ( "can't compare apples with oranges" )
1081+ . with_label ( Label :: new ( 0 ..5 ) )
1082+ . with_label ( Label :: new ( 9 ..15 ) )
1083+ . finish ( )
1084+ . write_to_string ( Source :: from ( source) ) ,
1085+ ) ;
1086+ assert_snapshot ! ( msg, @r###"
1087+ Error: can't compare apples with oranges
1088+ ,-[ <unknown>:1:1 ]
1089+ |
1090+ 1 | apple
1091+ | ^^^^^
1092+ 2 | == orange;
1093+ | ^^^^^^
1094+ ---'
1095+ "### ) ;
1096+ }
1097+
10741098 #[ test]
10751099 fn two_labels_with_messages ( ) {
10761100 let source = "apple == orange;" ;
@@ -1097,6 +1121,32 @@ mod tests {
10971121 "### ) ;
10981122 }
10991123
1124+ #[ test]
1125+ fn two_labels_with_messages_on_different_lines ( ) {
1126+ let source = "apple ==\n orange;" ;
1127+ let msg = remove_trailing (
1128+ Report :: build ( ReportKind :: Error , 0 ..0 )
1129+ . with_config ( no_color_and_ascii ( ) )
1130+ . with_message ( "can't compare apples with oranges" )
1131+ . with_label ( Label :: new ( 0 ..5 ) . with_message ( "This is an apple" ) )
1132+ . with_label ( Label :: new ( 9 ..15 ) . with_message ( "This is an orange" ) )
1133+ . finish ( )
1134+ . write_to_string ( Source :: from ( source) ) ,
1135+ ) ;
1136+ assert_snapshot ! ( msg, @r###"
1137+ Error: can't compare apples with oranges
1138+ ,-[ <unknown>:1:1 ]
1139+ |
1140+ 1 | apple ==
1141+ | ^^|^^
1142+ | `---- This is an apple
1143+ 2 | orange;
1144+ | ^^^|^^
1145+ | `---- This is an orange
1146+ ---'
1147+ "### ) ;
1148+ }
1149+
11001150 #[ test]
11011151 fn multi_byte_chars ( ) {
11021152 let source = "äpplë == örängë;" ;
0 commit comments