File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -469,16 +469,19 @@ mod tests {
469
469
use char:: from_u32;
470
470
471
471
#[ test]
472
- fn test_ascii ( ) {
473
- assert ! ( "banana" . chars( ) . all( |c| c. is_ascii( ) ) ) ;
474
- assert ! ( !"ประเทศไทย中华Việt Nam" . chars( ) . all( |c| c. is_ascii( ) ) ) ;
475
- }
472
+ fn test_is_ascii ( ) {
473
+ assert ! ( b"" . is_ascii( ) ) ;
474
+ assert ! ( b"banana\0 \x7F " . is_ascii( ) ) ;
475
+ assert ! ( b"banana\0 \x7F " . iter( ) . all( |b| b. is_ascii( ) ) ) ;
476
+ assert ! ( !b"Vi\xe1 \xbb \x87 t Nam" . is_ascii( ) ) ;
477
+ assert ! ( !b"Vi\xe1 \xbb \x87 t Nam" . iter( ) . all( |b| b. is_ascii( ) ) ) ;
478
+ assert ! ( !b"\xe1 \xbb \x87 " . iter( ) . any( |b| b. is_ascii( ) ) ) ;
476
479
477
- #[ test]
478
- fn test_ascii_vec ( ) {
479
480
assert ! ( "" . is_ascii( ) ) ;
480
- assert ! ( "a" . is_ascii( ) ) ;
481
- assert ! ( !"\u{2009} " . is_ascii( ) ) ;
481
+ assert ! ( "banana\0 \u{7F} " . is_ascii( ) ) ;
482
+ assert ! ( "banana\0 \u{7F} " . chars( ) . all( |c| c. is_ascii( ) ) ) ;
483
+ assert ! ( !"ประเทศไทย中华Việt Nam" . chars( ) . all( |c| c. is_ascii( ) ) ) ;
484
+ assert ! ( !"ประเทศไทย中华ệ " . chars( ) . any( |c| c. is_ascii( ) ) ) ;
482
485
}
483
486
484
487
#[ test]
You can’t perform that action at this time.
0 commit comments