@@ -1524,18 +1524,14 @@ fn test_lines() {
1524
1524
t ( "bare\r " , & [ "bare\r " ] ) ;
1525
1525
t ( "bare\r cr" , & [ "bare\r cr" ] ) ;
1526
1526
t ( "Text\n \r " , & [ "Text" , "\r " ] ) ;
1527
- t ( "\n Märy häd ä little lämb\n \r \n Little lämb\n " , & [
1528
- "" ,
1529
- "Märy häd ä little lämb" ,
1530
- "" ,
1531
- "Little lämb" ,
1532
- ] ) ;
1533
- t ( "\r \n Märy häd ä little lämb\n \n Little lämb" , & [
1534
- "" ,
1535
- "Märy häd ä little lämb" ,
1536
- "" ,
1537
- "Little lämb" ,
1538
- ] ) ;
1527
+ t (
1528
+ "\n Märy häd ä little lämb\n \r \n Little lämb\n " ,
1529
+ & [ "" , "Märy häd ä little lämb" , "" , "Little lämb" ] ,
1530
+ ) ;
1531
+ t (
1532
+ "\r \n Märy häd ä little lämb\n \n Little lämb" ,
1533
+ & [ "" , "Märy häd ä little lämb" , "" , "Little lämb" ] ,
1534
+ ) ;
1539
1535
}
1540
1536
1541
1537
#[ test]
@@ -1978,73 +1974,88 @@ mod pattern {
1978
1974
assert_eq ! ( v, right) ;
1979
1975
}
1980
1976
1981
- make_test ! ( str_searcher_ascii_haystack, "bb" , "abbcbbd" , [
1982
- Reject ( 0 , 1 ) ,
1983
- Match ( 1 , 3 ) ,
1984
- Reject ( 3 , 4 ) ,
1985
- Match ( 4 , 6 ) ,
1986
- Reject ( 6 , 7 ) ,
1987
- ] ) ;
1988
- make_test ! ( str_searcher_ascii_haystack_seq, "bb" , "abbcbbbbd" , [
1989
- Reject ( 0 , 1 ) ,
1990
- Match ( 1 , 3 ) ,
1991
- Reject ( 3 , 4 ) ,
1992
- Match ( 4 , 6 ) ,
1993
- Match ( 6 , 8 ) ,
1994
- Reject ( 8 , 9 ) ,
1995
- ] ) ;
1996
- make_test ! ( str_searcher_empty_needle_ascii_haystack, "" , "abbcbbd" , [
1997
- Match ( 0 , 0 ) ,
1998
- Reject ( 0 , 1 ) ,
1999
- Match ( 1 , 1 ) ,
2000
- Reject ( 1 , 2 ) ,
2001
- Match ( 2 , 2 ) ,
2002
- Reject ( 2 , 3 ) ,
2003
- Match ( 3 , 3 ) ,
2004
- Reject ( 3 , 4 ) ,
2005
- Match ( 4 , 4 ) ,
2006
- Reject ( 4 , 5 ) ,
2007
- Match ( 5 , 5 ) ,
2008
- Reject ( 5 , 6 ) ,
2009
- Match ( 6 , 6 ) ,
2010
- Reject ( 6 , 7 ) ,
2011
- Match ( 7 , 7 ) ,
2012
- ] ) ;
2013
- make_test ! ( str_searcher_multibyte_haystack, " " , "├──" , [
2014
- Reject ( 0 , 3 ) ,
2015
- Reject ( 3 , 6 ) ,
2016
- Reject ( 6 , 9 ) ,
2017
- ] ) ;
2018
- make_test ! ( str_searcher_empty_needle_multibyte_haystack, "" , "├──" , [
2019
- Match ( 0 , 0 ) ,
2020
- Reject ( 0 , 3 ) ,
2021
- Match ( 3 , 3 ) ,
2022
- Reject ( 3 , 6 ) ,
2023
- Match ( 6 , 6 ) ,
2024
- Reject ( 6 , 9 ) ,
2025
- Match ( 9 , 9 ) ,
2026
- ] ) ;
1977
+ make_test ! (
1978
+ str_searcher_ascii_haystack,
1979
+ "bb" ,
1980
+ "abbcbbd" ,
1981
+ [ Reject ( 0 , 1 ) , Match ( 1 , 3 ) , Reject ( 3 , 4 ) , Match ( 4 , 6 ) , Reject ( 6 , 7 ) , ]
1982
+ ) ;
1983
+ make_test ! (
1984
+ str_searcher_ascii_haystack_seq,
1985
+ "bb" ,
1986
+ "abbcbbbbd" ,
1987
+ [ Reject ( 0 , 1 ) , Match ( 1 , 3 ) , Reject ( 3 , 4 ) , Match ( 4 , 6 ) , Match ( 6 , 8 ) , Reject ( 8 , 9 ) , ]
1988
+ ) ;
1989
+ make_test ! (
1990
+ str_searcher_empty_needle_ascii_haystack,
1991
+ "" ,
1992
+ "abbcbbd" ,
1993
+ [
1994
+ Match ( 0 , 0 ) ,
1995
+ Reject ( 0 , 1 ) ,
1996
+ Match ( 1 , 1 ) ,
1997
+ Reject ( 1 , 2 ) ,
1998
+ Match ( 2 , 2 ) ,
1999
+ Reject ( 2 , 3 ) ,
2000
+ Match ( 3 , 3 ) ,
2001
+ Reject ( 3 , 4 ) ,
2002
+ Match ( 4 , 4 ) ,
2003
+ Reject ( 4 , 5 ) ,
2004
+ Match ( 5 , 5 ) ,
2005
+ Reject ( 5 , 6 ) ,
2006
+ Match ( 6 , 6 ) ,
2007
+ Reject ( 6 , 7 ) ,
2008
+ Match ( 7 , 7 ) ,
2009
+ ]
2010
+ ) ;
2011
+ make_test ! (
2012
+ str_searcher_multibyte_haystack,
2013
+ " " ,
2014
+ "├──" ,
2015
+ [ Reject ( 0 , 3 ) , Reject ( 3 , 6 ) , Reject ( 6 , 9 ) , ]
2016
+ ) ;
2017
+ make_test ! (
2018
+ str_searcher_empty_needle_multibyte_haystack,
2019
+ "" ,
2020
+ "├──" ,
2021
+ [
2022
+ Match ( 0 , 0 ) ,
2023
+ Reject ( 0 , 3 ) ,
2024
+ Match ( 3 , 3 ) ,
2025
+ Reject ( 3 , 6 ) ,
2026
+ Match ( 6 , 6 ) ,
2027
+ Reject ( 6 , 9 ) ,
2028
+ Match ( 9 , 9 ) ,
2029
+ ]
2030
+ ) ;
2027
2031
make_test ! ( str_searcher_empty_needle_empty_haystack, "" , "" , [ Match ( 0 , 0 ) , ] ) ;
2028
2032
make_test ! ( str_searcher_nonempty_needle_empty_haystack, "├" , "" , [ ] ) ;
2029
- make_test ! ( char_searcher_ascii_haystack, 'b' , "abbcbbd" , [
2030
- Reject ( 0 , 1 ) ,
2031
- Match ( 1 , 2 ) ,
2032
- Match ( 2 , 3 ) ,
2033
- Reject ( 3 , 4 ) ,
2034
- Match ( 4 , 5 ) ,
2035
- Match ( 5 , 6 ) ,
2036
- Reject ( 6 , 7 ) ,
2037
- ] ) ;
2038
- make_test ! ( char_searcher_multibyte_haystack, ' ' , "├──" , [
2039
- Reject ( 0 , 3 ) ,
2040
- Reject ( 3 , 6 ) ,
2041
- Reject ( 6 , 9 ) ,
2042
- ] ) ;
2043
- make_test ! ( char_searcher_short_haystack, '\u{1F4A9}' , "* \t " , [
2044
- Reject ( 0 , 1 ) ,
2045
- Reject ( 1 , 2 ) ,
2046
- Reject ( 2 , 3 ) ,
2047
- ] ) ;
2033
+ make_test ! (
2034
+ char_searcher_ascii_haystack,
2035
+ 'b' ,
2036
+ "abbcbbd" ,
2037
+ [
2038
+ Reject ( 0 , 1 ) ,
2039
+ Match ( 1 , 2 ) ,
2040
+ Match ( 2 , 3 ) ,
2041
+ Reject ( 3 , 4 ) ,
2042
+ Match ( 4 , 5 ) ,
2043
+ Match ( 5 , 6 ) ,
2044
+ Reject ( 6 , 7 ) ,
2045
+ ]
2046
+ ) ;
2047
+ make_test ! (
2048
+ char_searcher_multibyte_haystack,
2049
+ ' ' ,
2050
+ "├──" ,
2051
+ [ Reject ( 0 , 3 ) , Reject ( 3 , 6 ) , Reject ( 6 , 9 ) , ]
2052
+ ) ;
2053
+ make_test ! (
2054
+ char_searcher_short_haystack,
2055
+ '\u{1F4A9}' ,
2056
+ "* \t " ,
2057
+ [ Reject ( 0 , 1 ) , Reject ( 1 , 2 ) , Reject ( 2 , 3 ) , ]
2058
+ ) ;
2048
2059
2049
2060
// See #85462
2050
2061
#[ test]
@@ -2297,21 +2308,21 @@ fn utf8_chars() {
2297
2308
assert_eq ! ( schs. len( ) , 4 ) ;
2298
2309
assert_eq ! ( schs. iter( ) . cloned( ) . collect:: <String >( ) , s) ;
2299
2310
2300
- assert ! ( ( from_utf8( s. as_bytes( ) ) . is_ok( ) ) ) ;
2311
+ assert ! ( from_utf8( s. as_bytes( ) ) . is_ok( ) ) ;
2301
2312
// invalid prefix
2302
- assert ! ( ( !from_utf8( & [ 0x80 ] ) . is_ok( ) ) ) ;
2313
+ assert ! ( !from_utf8( & [ 0x80 ] ) . is_ok( ) ) ;
2303
2314
// invalid 2 byte prefix
2304
- assert ! ( ( !from_utf8( & [ 0xc0 ] ) . is_ok( ) ) ) ;
2305
- assert ! ( ( !from_utf8( & [ 0xc0 , 0x10 ] ) . is_ok( ) ) ) ;
2315
+ assert ! ( !from_utf8( & [ 0xc0 ] ) . is_ok( ) ) ;
2316
+ assert ! ( !from_utf8( & [ 0xc0 , 0x10 ] ) . is_ok( ) ) ;
2306
2317
// invalid 3 byte prefix
2307
- assert ! ( ( !from_utf8( & [ 0xe0 ] ) . is_ok( ) ) ) ;
2308
- assert ! ( ( !from_utf8( & [ 0xe0 , 0x10 ] ) . is_ok( ) ) ) ;
2309
- assert ! ( ( !from_utf8( & [ 0xe0 , 0xff , 0x10 ] ) . is_ok( ) ) ) ;
2318
+ assert ! ( !from_utf8( & [ 0xe0 ] ) . is_ok( ) ) ;
2319
+ assert ! ( !from_utf8( & [ 0xe0 , 0x10 ] ) . is_ok( ) ) ;
2320
+ assert ! ( !from_utf8( & [ 0xe0 , 0xff , 0x10 ] ) . is_ok( ) ) ;
2310
2321
// invalid 4 byte prefix
2311
- assert ! ( ( !from_utf8( & [ 0xf0 ] ) . is_ok( ) ) ) ;
2312
- assert ! ( ( !from_utf8( & [ 0xf0 , 0x10 ] ) . is_ok( ) ) ) ;
2313
- assert ! ( ( !from_utf8( & [ 0xf0 , 0xff , 0x10 ] ) . is_ok( ) ) ) ;
2314
- assert ! ( ( !from_utf8( & [ 0xf0 , 0xff , 0xff , 0x10 ] ) . is_ok( ) ) ) ;
2322
+ assert ! ( !from_utf8( & [ 0xf0 ] ) . is_ok( ) ) ;
2323
+ assert ! ( !from_utf8( & [ 0xf0 , 0x10 ] ) . is_ok( ) ) ;
2324
+ assert ! ( !from_utf8( & [ 0xf0 , 0xff , 0x10 ] ) . is_ok( ) ) ;
2325
+ assert ! ( !from_utf8( & [ 0xf0 , 0xff , 0xff , 0x10 ] ) . is_ok( ) ) ;
2315
2326
}
2316
2327
2317
2328
#[ test]
0 commit comments