@@ -7,6 +7,12 @@ using Unicode_Entities
7
7
8
8
UE = Unicode_Entities
9
9
10
+ ue_matchchar (ch) = UE. matchchar (UE. default, ch)
11
+ ue_lookupname (nam) = UE. lookupname (UE. default, nam)
12
+ ue_longestmatches (str) = UE. longestmatches (UE. default, str)
13
+ ue_matches (str) = UE. matches (UE. default, str)
14
+ ue_completions (str) = UE. completions (UE. default, str)
15
+
10
16
const datapath = joinpath (Pkg. dir (), " Unicode_Entities" , " data" )
11
17
const dpath = " ftp://ftp.unicode.org/Public/UNIDATA/"
12
18
const fname = " UnicodeData.txt"
@@ -51,67 +57,65 @@ function load_unicode_data()
51
57
end
52
58
53
59
load_unicode_data ()
54
- uln = UE. lookupname
55
- umc = UE. matchchar
56
60
57
61
@testset " Unicode_Entities" begin
58
62
59
63
@testset " matches data file" begin
60
64
for (i, ch) in enumerate (symval)
61
- list = umc (ch)
65
+ list = ue_matchchar (ch)
62
66
if ! isempty (list)
63
67
@test symnam[i] in list
64
68
end
65
69
end
66
70
for (i, nam) in enumerate (symnam)
67
- str = uln (nam)
71
+ str = ue_lookupname (nam)
68
72
if str != " "
69
73
@test symval[i] == str[1 ]
70
74
end
71
75
end
72
76
end
73
77
74
78
@testset " lookupname" begin
75
- @test UE . lookupname (" foobar" ) == " "
76
- @test UE . lookupname (SubString (" My name is Spock" , 12 )) == " "
77
- @test UE . lookupname (" end of text" ) == " \x 03" # \3
78
- @test UE . lookupname (" TIBETAN LETTER -A" ) == " \u 0f60"
79
- @test UE . lookupname (" LESS-THAN OR SLANTED EQUAL TO" ) == " \u 2a7d"
80
- @test UE . lookupname (" REVERSED HAND WITH MIDDLE FINGER EXTENDED" ) == " \U 1f595"
79
+ @test ue_lookupname (" foobar" ) == " "
80
+ @test ue_lookupname (SubString (" My name is Spock" , 12 )) == " "
81
+ @test ue_lookupname (" end of text" ) == " \x 03" # \3
82
+ @test ue_lookupname (" TIBETAN LETTER -A" ) == " \u 0f60"
83
+ @test ue_lookupname (" LESS-THAN OR SLANTED EQUAL TO" ) == " \u 2a7d"
84
+ @test ue_lookupname (" REVERSED HAND WITH MIDDLE FINGER EXTENDED" ) == " \U 1f595"
81
85
end
82
86
83
87
@testset " matches" begin
84
- @test isempty (UE . matches (" " ))
85
- @test isempty (UE . matches (" \u f900" ))
86
- @test isempty (UE . matches (SubString (" This is \u f900" , 9 )))
88
+ @test isempty (ue_matches (" " ))
89
+ @test isempty (ue_matches (" \u f900" ))
90
+ @test isempty (ue_matches (SubString (" This is \u f900" , 9 )))
87
91
for (chrs, exp) in ((" \U 1f596" , [" RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS" ]),
88
92
(" \u 0f4a" , [" TIBETAN LETTER REVERSED TA" ]),
89
93
(" ." , [" FULL STOP" , " PERIOD" ]))
90
- res = UE . matches (chrs)
94
+ res = ue_matches (chrs)
91
95
@test length (res) >= length (exp)
92
96
@test intersect (res, exp) == exp
93
97
end
94
98
end
95
99
96
100
@testset " longestmatches" begin
97
- @test isempty (UE . longestmatches (" \u f900 abcd" ))
98
- @test isempty (UE . longestmatches (SubString (" This is \u f900 abcd" , 9 )))
101
+ @test isempty (ue_longestmatches (" \u f900 abcd" ))
102
+ @test isempty (ue_longestmatches (SubString (" This is \u f900 abcd" , 9 )))
99
103
for (chrs, exp) in ((" \U 1f596 abcd" , [" RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS" ]),
100
104
(" .abcd" , [" FULL STOP" , " PERIOD" ]),
101
105
(" \u 0f4a#123" , [" TIBETAN LETTER REVERSED TA" , " TIBETAN LETTER TTA" ]))
102
- res = UE . longestmatches (chrs)
106
+ res = ue_longestmatches (chrs)
103
107
@test length (res) >= length (exp)
104
108
@test intersect (res, exp) == exp
105
109
end
106
110
end
107
111
108
112
@testset " completions" begin
109
- @test isempty (UE . completions (" ScottPaulJones" ))
110
- @test isempty (UE . completions (SubString (" My name is Scott" , 12 )))
113
+ @test isempty (ue_completions (" ScottPaulJones" ))
114
+ @test isempty (ue_completions (SubString (" My name is Scott" , 12 )))
111
115
for (chrs, exp) in ((" ZERO" , [" ZERO WIDTH JOINER" , " ZERO WIDTH NO-BREAK SPACE" ,
112
116
" ZERO WIDTH NON-JOINER" , " ZERO WIDTH SPACE" ]),
113
117
(" BACK OF" , [" BACK OF ENVELOPE" ]))
114
- res = UE . completions (chrs)
118
+ res = ue_completions (chrs)
115
119
@test length (res) >= length (exp)
116
120
@test intersect (res, exp) == exp
117
121
end
0 commit comments