utf8_validator 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,9 +27,26 @@ Other interesting and/or useful information can be found:
27
27
 
28
28
  == A Word On Ruby Versions
29
29
 
30
- It is expected that this validator will be used in Ruby environments prior to 1.9.x. However, nothing prohibits use with Ruby 1.9. Tests recognize a 1.9 environment, and insure that 1.9 native behavior matches the validator behavior.
30
+ It is expected that this validator will be used in Ruby environments prior to 1.9.x. However, nothing prohibits use with Ruby 1.9 or 2.0. Tests recognize these environments and adjust behavior accordingly.
31
31
 
32
- Testing done with 1.8.6 and 1.8.7.
32
+ Testing for 1.8.x done using:
33
+
34
+ * 1.8.5_231
35
+ * 1.8.6_383
36
+ * 1.8.7_299
37
+
38
+ Testing for 1.9.x done using a variety of versions, including:
39
+
40
+ * 1.9.1p378
41
+ * 1.9.1p431
42
+ * 1.9.2p188
43
+ * 1.9.3p358
44
+
45
+ and others.
46
+
47
+ Testing for 2.0.x done using:
48
+
49
+ * 2.0.0p0
33
50
 
34
51
  == Reporting Issues
35
52
 
@@ -56,6 +73,6 @@ Human readable documentation can be found at:
56
73
 
57
74
  == Copyright
58
75
 
59
- Copyright (c) 2011 Guy Allard. See LICENSE.txt for
76
+ Copyright (c) 2011-2013 Guy Allard. See LICENSE.txt for
60
77
  further details.
61
78
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -20,6 +20,7 @@ class TestUtf8Validator < Test::Unit::TestCase
20
20
  #
21
21
  def setup
22
22
  @validator = UTF8::Validator.new
23
+ @vercheck = ((RUBY_VERSION =~ /1\.9/) or (RUBY_VERSION =~ /2\.0/)) ? true : false
23
24
  end
24
25
 
25
26
  #
@@ -45,7 +46,7 @@ class TestUtf8Validator < Test::Unit::TestCase
45
46
  ]
46
47
  test_data.each do |string|
47
48
  assert @validator.valid_encoding?(string), "Simple ASCII: #{string}"
48
- assert string.force_encoding("UTF-8").valid_encoding?, "Simple ASCII 19: #{string}" if RUBY_VERSION =~ /1\.9/
49
+ assert string.force_encoding("UTF-8").valid_encoding?, "Simple ASCII 19: #{string}" if @vercheck
49
50
  end
50
51
  end
51
52
 
@@ -53,7 +54,7 @@ class TestUtf8Validator < Test::Unit::TestCase
53
54
  def test_0030_all_ascii
54
55
  0.upto(127) do |i|
55
56
  assert @validator.valid_encoding?(i.chr), "All ASCII: #{i.chr}"
56
- assert i.chr.force_encoding("UTF-8").valid_encoding?, "All ASCII 19: #{i.chr}" if RUBY_VERSION =~ /1\.9/
57
+ assert i.chr.force_encoding("UTF-8").valid_encoding?, "All ASCII 19: #{i.chr}" if @vercheck
57
58
  end
58
59
  end
59
60
 
@@ -67,7 +68,7 @@ class TestUtf8Validator < Test::Unit::TestCase
67
68
  ]
68
69
  test_data.each do |string|
69
70
  assert @validator.valid_encoding?(string), "Simple UTF-8, 2bytes: #{string}"
70
- assert string.force_encoding("UTF-8").valid_encoding?, "Simple UTF-8 19, 2bytes: #{string}" if RUBY_VERSION =~ /1\.9/
71
+ assert string.force_encoding("UTF-8").valid_encoding?, "Simple UTF-8 19, 2bytes: #{string}" if @vercheck
71
72
  end
72
73
  end
73
74
 
@@ -81,7 +82,7 @@ class TestUtf8Validator < Test::Unit::TestCase
81
82
  ]
82
83
  test_data.each do |string|
83
84
  assert @validator.valid_encoding?(string), "Simple UTF-8, 3bytes: #{string}"
84
- assert string.force_encoding("UTF-8").valid_encoding?, "Simple UTF-8 19, 3bytes: #{string}" if RUBY_VERSION =~ /1\.9/
85
+ assert string.force_encoding("UTF-8").valid_encoding?, "Simple UTF-8 19, 3bytes: #{string}" if @vercheck
85
86
  end
86
87
  end
87
88
 
@@ -97,7 +98,7 @@ class TestUtf8Validator < Test::Unit::TestCase
97
98
  ]
98
99
  test_data.each do |string|
99
100
  assert @validator.valid_encoding?(string), "Simple UTF-8, 4bytes: #{string}"
100
- assert string.force_encoding("UTF-8").valid_encoding?, "Simple UTF-8 19, 4bytes: #{string}" if RUBY_VERSION =~ /1\.9/
101
+ assert string.force_encoding("UTF-8").valid_encoding?, "Simple UTF-8 19, 4bytes: #{string}" if @vercheck
101
102
  end
102
103
  end
103
104
 
@@ -107,11 +108,11 @@ class TestUtf8Validator < Test::Unit::TestCase
107
108
  "\xed\x9f\xbf", # = "\ud7ff"
108
109
  "\xee\x80\x80", # = "\ue000"
109
110
  "\xef\xbf\xbd", # = "\ufffd"
110
- "\xf4\x8f\xbf\xbf", # = "\U10ffff" / _should_ this fail ??
111
+ "\xf4\x8f\xbf\xbf", # = "\U10ffff"
111
112
  ]
112
113
  test_data.each do |string|
113
114
  assert @validator.valid_encoding?(string), "boundary conditions: #{string}"
114
- assert string.force_encoding("UTF-8").valid_encoding?, "boundary conditions 19: #{string}" if RUBY_VERSION =~ /1\.9/
115
+ assert string.force_encoding("UTF-8").valid_encoding?, "boundary conditions 19: #{string}" if @vercheck
115
116
  end
116
117
  end
117
118
 
@@ -124,7 +125,7 @@ class TestUtf8Validator < Test::Unit::TestCase
124
125
  ]
125
126
  test_data.each do |string|
126
127
  assert @validator.valid_encoding?(string), "interesting valid strings: #{string}"
127
- assert string.force_encoding("UTF-8").valid_encoding?, "interesting valid strings 19: #{string}" if RUBY_VERSION =~ /1\.9/
128
+ assert string.force_encoding("UTF-8").valid_encoding?, "interesting valid strings 19: #{string}" if @vercheck
128
129
  end
129
130
  end
130
131
 
@@ -137,7 +138,7 @@ class TestUtf8Validator < Test::Unit::TestCase
137
138
  def test0510_iso_5559_1
138
139
  0x80.upto(0x9f) do |i|
139
140
  assert !@validator.valid_encoding?(i.chr), "ISO-8859-1: #{i}"
140
- assert !i.chr.force_encoding("UTF-8").valid_encoding?, "ISO-8859-1 19: #{i}" if RUBY_VERSION =~ /1\.9/
141
+ assert !i.chr.force_encoding("UTF-8").valid_encoding?, "ISO-8859-1 19: #{i}" if @vercheck
141
142
  end
142
143
  end
143
144
 
@@ -154,7 +155,7 @@ class TestUtf8Validator < Test::Unit::TestCase
154
155
  ]
155
156
  test_data.each do |string|
156
157
  assert !@validator.valid_encoding?(string), "UTF-16 Surrogate Halves: #{string}"
157
- assert !string.force_encoding("UTF-8").valid_encoding?, "UTF-16 Surrogate Halves 19: #{string}" if RUBY_VERSION =~ /1\.9/
158
+ assert !string.force_encoding("UTF-8").valid_encoding?, "UTF-16 Surrogate Halves 19: #{string}" if @vercheck
158
159
  end
159
160
  end
160
161
 
@@ -176,7 +177,7 @@ class TestUtf8Validator < Test::Unit::TestCase
176
177
  ]
177
178
  test_data.each do |string|
178
179
  assert !@validator.valid_encoding?(string), "Invalid single bytes: #{string}"
179
- assert !string.force_encoding("UTF-8").valid_encoding?, "Invalid single bytes 10: #{string}" if RUBY_VERSION =~ /1\.9/
180
+ assert !string.force_encoding("UTF-8").valid_encoding?, "Invalid single bytes 10: #{string}" if @vercheck
180
181
  end
181
182
  end
182
183
 
@@ -192,7 +193,7 @@ class TestUtf8Validator < Test::Unit::TestCase
192
193
  ]
193
194
  test_data.each do |string|
194
195
  assert !@validator.valid_encoding?(string), "Not shortest: #{string}"
195
- assert !string.force_encoding("UTF-8").valid_encoding?, "Not shortest 19: #{string}" if RUBY_VERSION =~ /1\.9/
196
+ assert !string.force_encoding("UTF-8").valid_encoding?, "Not shortest 19: #{string}" if @vercheck
196
197
  end
197
198
  end
198
199
 
@@ -212,7 +213,7 @@ class TestUtf8Validator < Test::Unit::TestCase
212
213
  ]
213
214
  test_data.each do |string|
214
215
  assert !@validator.valid_encoding?(string), "truncated last: #{string}"
215
- assert !string.force_encoding("UTF-8").valid_encoding?, "truncated last 19: #{string}" if RUBY_VERSION =~ /1\.9/
216
+ assert !string.force_encoding("UTF-8").valid_encoding?, "truncated last 19: #{string}" if @vercheck
216
217
  end
217
218
  end
218
219
 
@@ -233,7 +234,7 @@ class TestUtf8Validator < Test::Unit::TestCase
233
234
  test_data.each do |string|
234
235
  string = "a" + string + "b"
235
236
  assert !@validator.valid_encoding?(string), "truncated in good: #{string}"
236
- assert !string.force_encoding("UTF-8").valid_encoding?, "truncated in good 19: #{string}" if RUBY_VERSION =~ /1\.9/
237
+ assert !string.force_encoding("UTF-8").valid_encoding?, "truncated in good 19: #{string}" if @vercheck
237
238
  end
238
239
  end
239
240
 
@@ -268,7 +269,7 @@ class TestUtf8Validator < Test::Unit::TestCase
268
269
  ]
269
270
  test_data.each do |string|
270
271
  assert !@validator.valid_encoding?(string), "miscellaneous bad: #{string}"
271
- assert !string.force_encoding("UTF-8").valid_encoding?, "miscellaneous bad 19: #{string}" if RUBY_VERSION =~ /1\.9/
272
+ assert !string.force_encoding("UTF-8").valid_encoding?, "miscellaneous bad 19: #{string}" if @vercheck
272
273
  end
273
274
  end
274
275
 
@@ -284,7 +285,7 @@ class TestUtf8Validator < Test::Unit::TestCase
284
285
  ]
285
286
  test_data.each do |string|
286
287
  assert !@validator.valid_encoding?(string), "max overlong seq: #{string}"
287
- assert !string.force_encoding("UTF-8").valid_encoding?, "max overlong seq 19: #{string}" if RUBY_VERSION =~ /1\.9/
288
+ assert !string.force_encoding("UTF-8").valid_encoding?, "max overlong seq 19: #{string}" if @vercheck
288
289
  end
289
290
  end
290
291
 
@@ -295,7 +296,7 @@ class TestUtf8Validator < Test::Unit::TestCase
295
296
  ]
296
297
  test_data.each do |string|
297
298
  assert !@validator.valid_encoding?(string), "boundary conditions: #{string}"
298
- assert !string.force_encoding("UTF-8").valid_encoding?, "boundary conditions 19: #{string}" if RUBY_VERSION =~ /1\.9/
299
+ assert !string.force_encoding("UTF-8").valid_encoding?, "boundary conditions 19: #{string}" if @vercheck
299
300
  end
300
301
  end
301
302
 
@@ -351,7 +352,7 @@ straight from the Unicode 6.0 spec. See page 92.
351
352
  good_data.each do |string|
352
353
  assert @validator.valid_encoding?(string), "good unicode specs 01: #{string}"
353
354
  assert string.force_encoding("UTF-8").valid_encoding?,
354
- "good unicode specs 01 19: #{string}" if RUBY_VERSION =~ /1\.9/
355
+ "good unicode specs 01 19: #{string}" if @vercheck
355
356
  end
356
357
 
357
358
  bad_data = [
@@ -360,7 +361,7 @@ straight from the Unicode 6.0 spec. See page 92.
360
361
  bad_data.each do |string|
361
362
  assert !@validator.valid_encoding?(string), "bad unicode specs 01: #{string}"
362
363
  assert !string.force_encoding("UTF-8").valid_encoding?,
363
- "bad unicode specs 01 19: #{string}" if RUBY_VERSION =~ /1\.9/
364
+ "bad unicode specs 01 19: #{string}" if @vercheck
364
365
  end
365
366
 
366
367
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{utf8_validator}
8
- s.version = "1.0.5"
8
+ s.version = "1.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Guy Allard"]
12
- s.date = %q{2013-02-24}
12
+ s.date = %q{2013-03-03}
13
13
  s.description = %q{A State Machine implementation of a UTF-8 Encoding
14
14
  Validation algorithm.}
15
15
  s.email = %q{allard.guy.m@gmail.com}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utf8_validator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 5
10
- version: 1.0.5
9
+ - 6
10
+ version: 1.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Guy Allard
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-02-24 00:00:00 -05:00
18
+ date: 2013-03-03 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency