-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.jl
133 lines (131 loc) · 4.49 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using StringCases
using Test
@testset "StringCases.jl" begin
@testset "Validate" begin
@test StringCases.isvalid("StringCasePat", StringCases.PASCAL_CASE) == true
@test StringCases.isvalid("StringCasePat", StringCases.CAMEL_CASE) == false
@test StringCases.isvalid("String Case Dlm", StringCases.TITLE_CASE) == true
@test StringCases.isvalid("α_β_δ", StringCases.SNAKE_CASE) == true
end
@testset "Convert" begin
@test StringCases.convert(
"StringCasePat",
StringCases.PASCAL_CASE,
StringCases.SNAKE_CASE,
) == "string_case_pat"
@test StringCases.convert(
"stringCasePat",
StringCases.CAMEL_CASE,
StringCases.SCREAMING_SNAKE_CASE,
) == "STRING_CASE_PAT"
@test StringCases.convert(
"string_case_dlm",
StringCases.SNAKE_CASE,
StringCases.TITLE_CASE,
) == "String Case Dlm"
@test StringCases.convert(
"α_β_δ",
StringCases.SNAKE_CASE,
StringCases.PASCAL_CASE,
) == "ΑΒΔ"
end
@testset "Pattern Splitting" begin
camel_title_case_acroall = StringCases.PatternStringCase(
"camelTitleCaseACRO",
lowercase,
titlecase,
lowercase,
StringCases.acro_all_of_token,
false,
)
camel_title_case_acrostart = StringCases.PatternStringCase(
"camelTitleCaseACro",
lowercase,
titlecase,
lowercase,
StringCases.acro_start_of_token,
false,
)
camel_title_case_acroend = StringCases.PatternStringCase(
"camelTitleCaseAcrO",
lowercase,
titlecase,
lowercase,
StringCases.acro_end_of_token,
false,
)
camel_title_case_num = StringCases.PatternStringCase(
"camelTitleCase23Num",
lowercase,
titlecase,
lowercase,
StringCases.acro_none_of_token,
true,
)
camel_title_case_acroall_num = StringCases.PatternStringCase(
"camelTitleCase23NUMACRO",
lowercase,
titlecase,
lowercase,
StringCases.acro_all_of_token,
true,
)
camel_title_case_acrostart_num = StringCases.PatternStringCase(
"camelTitleCase23NUmACro",
lowercase,
titlecase,
lowercase,
StringCases.acro_start_of_token,
true,
)
camel_title_case_acroend_num = StringCases.PatternStringCase(
"camelTitleCase23NuMAcRO",
lowercase,
titlecase,
lowercase,
StringCases.acro_end_of_token,
true,
)
test_string = "q2eryDžnterfaceFOמࠇPrice2৶3MמWzHRate2r"
@test StringCases.convert(
test_string,
StringCases.CAMEL_TITLE_CASE,
StringCases.SPACE_CASE,
) == "q2ery Džnterface F Oמࠇ Price2৶3 Mמ Wz H Rate2r"
@test StringCases.convert(
test_string,
camel_title_case_acroall,
StringCases.SPACE_CASE,
) == "q2ery Džnterface FOמࠇ Price2৶3 Mמ Wz H Rate2r"
@test StringCases.convert(
test_string,
camel_title_case_acrostart,
StringCases.SPACE_CASE,
) == "q2ery Džnterface FOמࠇPrice2৶3 MמWz HRate2r"
@test StringCases.convert(
test_string,
camel_title_case_acroend,
StringCases.SPACE_CASE,
) == "q2ery DžnterfaceFOמࠇ Price2৶3Mמ WzH Rate2r"
@test StringCases.convert(
test_string,
camel_title_case_num,
StringCases.SPACE_CASE,
) == "q 2ery Džnterface F Oמࠇ Price 2৶3 Mמ Wz H Rate 2r"
@test StringCases.convert(
test_string,
camel_title_case_acroall_num,
StringCases.SPACE_CASE,
) == "q 2ery Džnterface FOמࠇ Price 2৶3Mמ Wz H Rate 2r"
@test StringCases.convert(
test_string,
camel_title_case_acrostart_num,
StringCases.SPACE_CASE,
) == "q 2ery Džnterface FOמࠇPrice 2৶3MמWz HRate 2r"
@test StringCases.convert(
test_string,
camel_title_case_acroend_num,
StringCases.SPACE_CASE,
) == "q 2ery DžnterfaceFOמࠇ Price 2৶3Mמ WzH Rate 2r"
end
end