@@ -30,6 +30,15 @@ invalid = StringView([0x8b, 0x52, 0x9b, 0x8d])
30
30
@test codeunit (s) == UInt8
31
31
@test codeunit (s,3 ) == b[3 ]
32
32
33
+ @test Base. print_to_string (s) == " foobar"
34
+ @test Base. print_to_string (abc) == " abc"
35
+ end
36
+
37
+ @testset " regular expressions" begin
38
+ @test [m. match for m in collect (eachmatch (r" [aeiou]+" , s))] == [" oo" , " a" ]
39
+ end
40
+
41
+ @testset " miscellaneous" begin
33
42
@test cmp (" foobar" ," bar" ) == cmp (s," bar" ) == - cmp (" bar" ,s) == cmp (s,StringView (" bar" ))
34
43
@test s == StringView (" foobar" ) == " foobar" == s == " foobar" != StringView (" bar" )
35
44
@test cmp (abc, " bar" ) == cmp (" abc" ," bar" )
@@ -40,15 +49,12 @@ invalid = StringView([0x8b, 0x52, 0x9b, 0x8d])
40
49
@test isascii (s)
41
50
@test ! isascii (StringView (" fööbār" ))
42
51
43
- @test Base. print_to_string (s) == " foobar"
44
- @test Base. print_to_string (abc) == " abc"
45
-
46
52
@test isvalid (s)
47
53
@test isvalid (abc)
48
54
@test ! isvalid (invalid)
49
55
@test ! invoke (isvalid, Tuple{StringView}, invalid)
50
- end
51
56
52
- @testset " regular expressions" begin
53
- @test [m. match for m in collect (eachmatch (r" [aeiou]+" , s))] == [" oo" , " a" ]
54
- end
57
+ for str in (s, abc, invalid)
58
+ @test hash (s) == hash (String (s))
59
+ end
60
+ end
0 commit comments