twitter_cldr 4.3.1 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -7
- data/README.md +5 -5
- data/lib/twitter_cldr/collation/sort_key_builder.rb +5 -5
- data/lib/twitter_cldr/core_ext.rb +2 -8
- data/lib/twitter_cldr/parsers/parser.rb +4 -4
- data/lib/twitter_cldr/utils/range_set.rb +3 -1
- data/lib/twitter_cldr/utils/yaml.rb +17 -17
- data/lib/twitter_cldr/version.rb +1 -1
- data/spec/collation/collator_spec.rb +55 -34
- data/spec/collation/sort_key_builder_spec.rb +3 -3
- data/spec/collation/trie_builder_spec.rb +7 -5
- data/spec/collation/trie_loader_spec.rb +5 -1
- data/spec/collation/trie_with_fallback_spec.rb +4 -4
- data/spec/core_ext_spec.rb +1 -7
- data/spec/data_readers/date_time_data_reader_spec.rb +1 -1
- data/spec/data_readers/number_data_reader_spec.rb +1 -1
- data/spec/formatters/calendars/datetime_formatter_spec.rb +5 -5
- data/spec/formatters/plurals/plural_formatter_spec.rb +3 -3
- data/spec/formatters/plurals/rules_spec.rb +2 -2
- data/spec/localized/localized_array_spec.rb +6 -2
- data/spec/localized/localized_date_spec.rb +1 -1
- data/spec/localized/localized_datetime_spec.rb +2 -4
- data/spec/localized/localized_object_spec.rb +3 -3
- data/spec/localized/localized_string_spec.rb +6 -4
- data/spec/localized/localized_symbol_spec.rb +2 -2
- data/spec/normalization_spec.rb +5 -5
- data/spec/parsers/number_parser_spec.rb +12 -12
- data/spec/parsers/parser_spec.rb +1 -1
- data/spec/resources/loader_spec.rb +31 -31
- data/spec/shared/calendar_spec.rb +5 -5
- data/spec/shared/code_point_spec.rb +5 -5
- data/spec/shared/hyphenator_spec.rb +2 -2
- data/spec/shared/language_codes_spec.rb +7 -7
- data/spec/shared/languages_spec.rb +2 -2
- data/spec/shared/locale_spec.rb +10 -10
- data/spec/shared/numbers_spec.rb +5 -5
- data/spec/shared/phone_codes_spec.rb +4 -2
- data/spec/shared/postal_code_generator_spec.rb +1 -1
- data/spec/shared/properties_database_spec.rb +6 -6
- data/spec/shared/territories_containment_spec.rb +8 -8
- data/spec/shared/territories_spec.rb +10 -6
- data/spec/shared/territory_spec.rb +4 -5
- data/spec/spec_helper.rb +1 -2
- data/spec/twitter_cldr_spec.rb +20 -20
- data/spec/utils/range_set_spec.rb +7 -7
- data/spec/utils/regexp_ast_spec.rb +4 -4
- data/spec/utils/regexp_sampler_spec.rb +23 -23
- metadata +2 -2
@@ -161,16 +161,16 @@ describe RangeSet do
|
|
161
161
|
let(:set) { RangeSet.new([1..5, 9..16]) }
|
162
162
|
|
163
163
|
it "returns true if the set completely includes the range, false otherwise" do
|
164
|
-
expect(set
|
165
|
-
expect(set
|
166
|
-
expect(set
|
164
|
+
expect(set.include?(10..15)).to eq(true)
|
165
|
+
expect(set.include?(3..8)).to eq(false)
|
166
|
+
expect(set.include?(8..14)).to eq(false)
|
167
167
|
end
|
168
168
|
|
169
169
|
it "returns true if the set contains the value, false otherwise" do
|
170
|
-
expect(set).to
|
171
|
-
expect(set).to
|
172
|
-
expect(set
|
173
|
-
expect(set
|
170
|
+
expect(set.include?(3)).to eq(true)
|
171
|
+
expect(set.include?(10)).to eq(true)
|
172
|
+
expect(set.include?(6)).to eq(false)
|
173
|
+
expect(set.include?(8)).to eq(false)
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
@@ -22,10 +22,10 @@ describe RegexpAst do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def check_ast(obj)
|
25
|
-
obj.
|
25
|
+
expect(obj).to be_a(RegexpAst::Root)
|
26
26
|
expr = obj.expressions.first
|
27
|
-
expr.
|
28
|
-
expr.text.
|
27
|
+
expect(expr).to be_a(RegexpAst::Literal)
|
28
|
+
expect(expr.text).to eq('foobar')
|
29
29
|
end
|
30
30
|
|
31
31
|
describe "#dump" do
|
@@ -41,4 +41,4 @@ describe RegexpAst do
|
|
41
41
|
check_ast(obj)
|
42
42
|
end
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
@@ -34,97 +34,97 @@ describe RegexpSampler do
|
|
34
34
|
context "digits" do
|
35
35
|
it "should return a single digit when no quantifier" do
|
36
36
|
spl = make(digit.new([], nil))
|
37
|
-
spl.generate.
|
37
|
+
expect(spl.generate).to match(/\d/)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should return multiple digits when given a singular quantifier" do
|
41
41
|
spl = make(digit.new([], singular_quantifier))
|
42
|
-
spl.generate.
|
42
|
+
expect(spl.generate).to match(/\d{2}/)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should return the correct number of digits when given a ranged quantifier" do
|
46
46
|
spl = make(digit.new([], ranged_quantifier))
|
47
|
-
spl.generate.
|
47
|
+
expect(spl.generate).to match(/\d{2,4}/)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
context "words" do
|
52
52
|
it "should return a single word character when no quantifier" do
|
53
53
|
spl = make(word.new([], nil))
|
54
|
-
spl.generate.
|
54
|
+
expect(spl.generate).to match(/\w/)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should return multiple letter characters when given a singular quantifier" do
|
58
58
|
spl = make(word.new([], singular_quantifier))
|
59
|
-
spl.generate.
|
59
|
+
expect(spl.generate).to match(/\w{2}/)
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should return the correct number of word characters when given a ranged quantifier" do
|
63
63
|
spl = make(word.new([], ranged_quantifier))
|
64
|
-
spl.generate.
|
64
|
+
expect(spl.generate).to match(/\w{2,4}/)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
context "literals" do
|
69
69
|
it "should return the literal when no quantifier" do
|
70
70
|
spl = make(literal.new([], nil, 'foobar'))
|
71
|
-
spl.generate.
|
71
|
+
expect(spl.generate).to eq("foobar")
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should return multiple copies of the literal when given a singular quantifier" do
|
75
75
|
spl = make(literal.new([], singular_quantifier, 'foobar'))
|
76
|
-
spl.generate.
|
76
|
+
expect(spl.generate).to eq("foobarfoobar")
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should return the correct number of literal copies when given a ranged quantifier" do
|
80
80
|
spl = make(literal.new([], ranged_quantifier, 'foobar'))
|
81
|
-
spl.generate.
|
81
|
+
expect(spl.generate).to match(/(foobar){2,4}/)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
context "character sets" do
|
86
86
|
it "should handle single characters correctly" do
|
87
87
|
spl = make(character_set.new([], nil, ['a', 'b', 'c'], false))
|
88
|
-
spl.generate.
|
88
|
+
expect(spl.generate).to match(/[abc]/)
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should repeat characters when given a singular quantifier" do
|
92
92
|
spl = make(character_set.new([], singular_quantifier, ['a', 'b', 'c'], false))
|
93
|
-
spl.generate.
|
93
|
+
expect(spl.generate).to match(/[abc]{2}/)
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should repeat characters when given a ranged quantifier" do
|
97
97
|
spl = make(character_set.new([], ranged_quantifier, ['a', 'b', 'c'], false))
|
98
|
-
spl.generate.
|
98
|
+
expect(spl.generate).to match(/[abc]{2,4}/)
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should handle character ranges correctly" do
|
102
102
|
spl = make(character_set.new([], nil, ['a-z'], false))
|
103
|
-
spl.generate.
|
103
|
+
expect(spl.generate).to match(/[a-z]/)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should handle character ranges correctly when given a singular quantifier" do
|
107
107
|
spl = make(character_set.new([], singular_quantifier, ['a-z'], false))
|
108
|
-
spl.generate.
|
108
|
+
expect(spl.generate).to match(/[a-z]{2}/)
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should handle character ranges correctly when given a ranged quantifier" do
|
112
112
|
spl = make(character_set.new([], ranged_quantifier, ['a-z'], false))
|
113
|
-
spl.generate.
|
113
|
+
expect(spl.generate).to match(/[a-z]{2,4}/)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
context "captures" do
|
118
118
|
it "should ignore captures" do
|
119
119
|
spl = make(capture.new([digit.new([], nil)], nil))
|
120
|
-
spl.generate.
|
120
|
+
expect(spl.generate).to match(/\d/)
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
124
|
context "passives (i.e. non-capturing groups)" do
|
125
125
|
it "should ignore non-captures" do
|
126
126
|
spl = make(passive.new([digit.new([], nil)], nil))
|
127
|
-
spl.generate.
|
127
|
+
expect(spl.generate).to match(/\d/)
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
@@ -134,7 +134,7 @@ describe RegexpSampler do
|
|
134
134
|
literal.new([], nil, 'a'), digit.new([], nil)
|
135
135
|
], nil))
|
136
136
|
|
137
|
-
spl.generate.
|
137
|
+
expect(spl.generate).to match(/a|\d/)
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should handle alternation when given a singlular quantifier" do
|
@@ -142,7 +142,7 @@ describe RegexpSampler do
|
|
142
142
|
literal.new([], nil, 'a'), digit.new([], nil)
|
143
143
|
], singular_quantifier))
|
144
144
|
|
145
|
-
spl.generate.
|
145
|
+
expect(spl.generate).to match(/(?:a|\d){2}/)
|
146
146
|
end
|
147
147
|
|
148
148
|
it "should handle alternation when given a ranged quantifier" do
|
@@ -150,7 +150,7 @@ describe RegexpSampler do
|
|
150
150
|
literal.new([], nil, 'a'), digit.new([], nil)
|
151
151
|
], ranged_quantifier))
|
152
152
|
|
153
|
-
spl.generate.
|
153
|
+
expect(spl.generate).to match(/(?:a|\d){2,4}/)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -160,7 +160,7 @@ describe RegexpSampler do
|
|
160
160
|
digit.new([], nil), word.new([], nil), literal.new([], nil, 'a')
|
161
161
|
], nil))
|
162
162
|
|
163
|
-
spl.generate.
|
163
|
+
expect(spl.generate).to match(/\d\wa/)
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should process every element the specified number of times with a singular quantifier" do
|
@@ -168,7 +168,7 @@ describe RegexpSampler do
|
|
168
168
|
digit.new([], nil), word.new([], nil), literal.new([], nil, 'a')
|
169
169
|
], singular_quantifier))
|
170
170
|
|
171
|
-
spl.generate.
|
171
|
+
expect(spl.generate).to match(/(?:\d\wa){2}/)
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should process every element the specified number of times with a ranged quantifier" do
|
@@ -176,7 +176,7 @@ describe RegexpSampler do
|
|
176
176
|
digit.new([], nil), word.new([], nil), literal.new([], nil, 'a')
|
177
177
|
], ranged_quantifier))
|
178
178
|
|
179
|
-
spl.generate.
|
179
|
+
expect(spl.generate).to match(/(?:\d\wa){2,4}/)
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_cldr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: camertron-eprun
|