|
1 |
| -using HTML_Entities |
| 1 | +using StrTables, HTML_Entities |
2 | 2 |
|
3 | 3 | @static VERSION < v"0.7.0-DEV" ? (using Base.Test) : (using Test)
|
4 | 4 |
|
5 | 5 | # Test the functions lookupname, matches, longestmatches, completions
|
6 | 6 | # Check that characters from all 3 tables (BMP, non-BMP, string) are tested
|
7 | 7 |
|
8 |
| -HE = HTML_Entities |
9 |
| - |
10 |
| -he_matchchar(ch) = HE.matchchar(HE.default, ch) |
11 |
| -he_lookupname(nam) = HE.lookupname(HE.default, nam) |
12 |
| -he_longestmatches(str) = HE.longestmatches(HE.default, str) |
13 |
| -he_matches(str) = HE.matches(HE.default, str) |
14 |
| -he_completions(str) = HE.completions(HE.default, str) |
15 |
| - |
| 8 | +const def = HTML_Entities.default |
16 | 9 |
|
17 | 10 | @testset "HTML_Entities" begin
|
18 | 11 | @testset "lookupname" begin
|
19 |
| - @test he_lookupname(SubString("My name is Spock", 12)) == "" |
20 |
| - @test he_lookupname("foobar") == "" |
21 |
| - @test he_lookupname("nle") == "\u2270" |
22 |
| - @test he_lookupname("Pscr") == "\U1d4ab" |
23 |
| - @test he_lookupname("lvnE") == "\u2268\ufe00" |
| 12 | + @test lookupname(def, SubString("My name is Spock", 12)) == "" |
| 13 | + @test lookupname(def, "foobar") == "" |
| 14 | + @test lookupname(def, "nle") == "\u2270" |
| 15 | + @test lookupname(def, "Pscr") == "\U1d4ab" |
| 16 | + @test lookupname(def, "lvnE") == "\u2268\ufe00" |
24 | 17 | end
|
25 | 18 |
|
26 | 19 | @testset "matches" begin
|
27 |
| - @test isempty(he_matches("")) |
28 |
| - @test isempty(he_matches("\u201f")) |
29 |
| - @test isempty(he_matches(SubString("This is \u201f", 9))) |
| 20 | + @test isempty(matches(def, "")) |
| 21 | + @test isempty(matches(def, "\u201f")) |
| 22 | + @test isempty(matches(def, SubString("This is \u201f", 9))) |
30 | 23 | for (chrs, exp) in (("\u2270", ["nle", "nleq"]),
|
31 | 24 | ("\U1d4ab", ["Pscr"]),
|
32 | 25 | ("\U1d51e", ["afr"]),
|
33 | 26 | ("\u2268\ufe00", ["lvertneqq", "lvnE"]))
|
34 |
| - res = he_matches(chrs) |
| 27 | + res = matches(def, chrs) |
35 | 28 | @test length(res) >= length(exp)
|
36 | 29 | @test intersect(res, exp) == exp
|
37 | 30 | end
|
38 | 31 | end
|
39 | 32 |
|
40 | 33 | @testset "longestmatches" begin
|
41 |
| - @test isempty(he_longestmatches("\u201f abcd")) |
42 |
| - @test isempty(he_longestmatches(SubString("This is \U201f abcd", 9))) |
| 34 | + @test isempty(longestmatches(def, "\u201f abcd")) |
| 35 | + @test isempty(longestmatches(def, SubString("This is \U201f abcd", 9))) |
43 | 36 | for (chrs, exp) in (("\u2270 abcd", ["nle", "nleq"]),
|
44 | 37 | ("\U1d4ab abcd", ["Pscr"]),
|
45 | 38 | ("\u2268\ufe00 silly", ["lvertneqq", "lvnE"]))
|
46 |
| - res = he_longestmatches(chrs) |
| 39 | + res = longestmatches(def, chrs) |
47 | 40 | @test length(res) >= length(exp)
|
48 | 41 | @test intersect(res, exp) == exp
|
49 | 42 | end
|
50 | 43 | end
|
51 | 44 |
|
52 | 45 | @testset "completions" begin
|
53 |
| - @test isempty(he_completions("ScottPaulJones")) |
54 |
| - @test isempty(he_completions(SubString("My name is Scott", 12))) |
| 46 | + @test isempty(completions(def, "ScottPaulJones")) |
| 47 | + @test isempty(completions(def, SubString("My name is Scott", 12))) |
55 | 48 | for (chrs, exp) in (("and", ["and", "andand", "andd", "andslope", "andv"]),
|
56 | 49 | ("um", ["umacr", "uml"]))
|
57 |
| - res = he_completions(chrs) |
| 50 | + res = completions(def, chrs) |
58 | 51 | @test length(res) >= length(exp)
|
59 | 52 | @test intersect(res, exp) == exp
|
60 | 53 | end
|
|
0 commit comments