Skip to content

Commit f399fe1

Browse files
authored
Merge pull request #7 from JuliaString/spj/usedef
Use default
2 parents 8a14e7b + ba2f17c commit f399fe1

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

test/runtests.jl

+17-24
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,53 @@
1-
using HTML_Entities
1+
using StrTables, HTML_Entities
22

33
@static VERSION < v"0.7.0-DEV" ? (using Base.Test) : (using Test)
44

55
# Test the functions lookupname, matches, longestmatches, completions
66
# Check that characters from all 3 tables (BMP, non-BMP, string) are tested
77

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
169

1710
@testset "HTML_Entities" begin
1811
@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"
2417
end
2518

2619
@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)))
3023
for (chrs, exp) in (("\u2270", ["nle", "nleq"]),
3124
("\U1d4ab", ["Pscr"]),
3225
("\U1d51e", ["afr"]),
3326
("\u2268\ufe00", ["lvertneqq", "lvnE"]))
34-
res = he_matches(chrs)
27+
res = matches(def, chrs)
3528
@test length(res) >= length(exp)
3629
@test intersect(res, exp) == exp
3730
end
3831
end
3932

4033
@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)))
4336
for (chrs, exp) in (("\u2270 abcd", ["nle", "nleq"]),
4437
("\U1d4ab abcd", ["Pscr"]),
4538
("\u2268\ufe00 silly", ["lvertneqq", "lvnE"]))
46-
res = he_longestmatches(chrs)
39+
res = longestmatches(def, chrs)
4740
@test length(res) >= length(exp)
4841
@test intersect(res, exp) == exp
4942
end
5043
end
5144

5245
@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)))
5548
for (chrs, exp) in (("and", ["and", "andand", "andd", "andslope", "andv"]),
5649
("um", ["umacr", "uml"]))
57-
res = he_completions(chrs)
50+
res = completions(def, chrs)
5851
@test length(res) >= length(exp)
5952
@test intersect(res, exp) == exp
6053
end

0 commit comments

Comments
 (0)