@@ -72,7 +72,7 @@ mutable struct CharStr <: AbstractString
7272 CharStr (x) = new (collect (x))
7373end
7474@static if NEW_ITERATE
75- literate (x:: CharStr , i:: Int = 1 ) = iterate (x. chars, i)
75+ iterate (x:: CharStr , i:: Int = 1 ) = iterate (x. chars, i)
7676else
7777 start (x:: CharStr ) = 1
7878 next (x:: CharStr , i:: Int ) = next (x. chars, i)
386386end
387387
388388@testset " issue #10307" begin
389- @test typeof (map (x -> parse (Int16, x), AbstractString[])) == Vector{Int16}
390-
389+ # @test typeof(map(x -> parse(Int16, x), AbstractString[])) == Vector{Int16}
390+ println (typeof (map (x -> parse (Int16, x), AbstractString[])))
391+
391392 for T in [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128]
392393 for i in [typemax (T), typemin (T)]
393394 s = " $i "
484485 (String (b "\u dbff\u dfff" ), false ),
485486 (String (b "\u d800\u 0100" ), false ),
486487 (String (b "\u dc00\u 0100" ), false ),
487- (String (b "\u dc00\u d800" ), false ),
488- )
488+ (String (b "\u dc00\u d800" ), false ))
489+ is_valid (ST, val) == pass ||
490+ println (idx, " :" , ST, " -> " , val)
489491 @test is_valid (ST, val) == pass
490492 V6_COMPAT || @test is_valid (C, val[1 ]) == pass
491493 end
@@ -513,16 +515,30 @@ end
513515 end
514516 end
515517 end
518+ # Check for short three-byte sequences
519+ @test is_valid (ST, UInt8[0xe0 ]) == false
520+ for (rng, flg) in ((0x00 : 0x9f , false ), (0xa0 : 0xbf , true ), (0xc0 : 0xff , false ))
521+ for cont in rng
522+ @test is_valid (ST, UInt8[0xe0 , cont]) == false
523+ is_valid (ST, UInt8[0xe0 , cont, 0x80 ]) == flg ||
524+ println (" isvalid($ST , [0x80, $cont , 0x80])" )
525+ if ST === String && (0x80 <= cont <= 0x9f )
526+ @test_broken is_valid (ST, UInt8[0xe0 , cont, 0x80 ]) == flg
527+ else
528+ @test is_valid (ST, UInt8[0xe0 , cont, 0x80 ]) == flg
529+ end
530+ end
531+ end
516532 # Check three-byte sequences
517- for r1 in (0xe0 : 0xec , 0xee : 0xef )
518- for byt = r1
519- # Check for short sequence
520- @test is_valid (ST, UInt8[byt]) == false
521- for (rng,flg) in (( 0x00 : 0x7f , false ), ( 0x80 : 0xbf , true ), ( 0xc0 : 0xff , false ))
522- for cont in rng
523- @test is_valid (ST, UInt8[byt, cont]) == false
524- @test is_valid ( ST, UInt8[ byt, cont, 0x80 ]) == flg
525- end
533+ for r1 in (0xe1 : 0xec , 0xee : 0xef ), byt in r1
534+ # Check for short sequence
535+ @test is_valid (ST, UInt8[byt]) == false
536+ for (rng, flg) in (( 0x00 : 0x7f , false ), ( 0x80 : 0xbf , true ), ( 0xc0 : 0xff , false ))
537+ for cont in rng
538+ @test is_valid (ST, UInt8[byt, cont]) == false
539+ is_valid (ST, UInt8[byt, cont, 0x80 ]) == flg ||
540+ println ( " isvalid( " , ST, " , [ " , byt, " , " , cont, " , 0x80])" )
541+ @test is_valid (ST, UInt8[byt, cont, 0x80 ]) == flg
526542 end
527543 end
528544 end
547563 for cont in rng
548564 @test is_valid (ST, UInt8[byt, cont]) == false
549565 @test is_valid (ST, UInt8[byt, cont, 0x80 ]) == false
566+ is_valid (ST, UInt8[byt, cont, 0x80 , 0x80 ]) == flg ||
567+ println (" isvalid(" , ST, " , [" , byt, " , " , cont, " , 0x80, 0x80])" )
550568 @test is_valid (ST, UInt8[byt, cont, 0x80 , 0x80 ]) == flg
551569 end
552570 end
0 commit comments