Skip to content

Commit 54e2bc7

Browse files
committed
hash test
1 parent 907da7b commit 54e2bc7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

test/runtests.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ invalid = StringView([0x8b, 0x52, 0x9b, 0x8d])
3030
@test codeunit(s) == UInt8
3131
@test codeunit(s,3) == b[3]
3232

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
3342
@test cmp("foobar","bar") == cmp(s,"bar") == -cmp("bar",s) == cmp(s,StringView("bar"))
3443
@test s == StringView("foobar") == "foobar" == s == "foobar" != StringView("bar")
3544
@test cmp(abc, "bar") == cmp("abc","bar")
@@ -40,15 +49,12 @@ invalid = StringView([0x8b, 0x52, 0x9b, 0x8d])
4049
@test isascii(s)
4150
@test !isascii(StringView("fööbār"))
4251

43-
@test Base.print_to_string(s) == "foobar"
44-
@test Base.print_to_string(abc) == "abc"
45-
4652
@test isvalid(s)
4753
@test isvalid(abc)
4854
@test !isvalid(invalid)
4955
@test !invoke(isvalid, Tuple{StringView}, invalid)
50-
end
5156

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

Comments
 (0)