chars 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -5
- data/ChangeLog.md +28 -11
- data/Gemfile +2 -0
- data/README.md +3 -3
- data/gemspec.yml +1 -0
- data/lib/chars/char_set.rb +13 -1
- data/lib/chars/chars.rb +10 -2
- data/lib/chars/version.rb +1 -1
- data/spec/char_set_spec.rb +36 -0
- data/spec/chars_spec.rb +80 -4
- data/spec/extensions/string_spec.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33adb9b0d02cf5d9c694e80e824bb4835b1503769e00d7f62ab901b35a46df64
|
4
|
+
data.tar.gz: ab56f3ae9533e9e5903aee56c491f6b40760694e4adc3d6ec364725182ccaeed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de94222563f4de2c9c68660d95af2d6d0cdc54ee53ac61b726022c02f064fbe493ec3a208937ec2dcb52593560ea4bf6e7935ad0e4ac8b7f7ecfa22afd55f3f4
|
7
|
+
data.tar.gz: 172429354850160c92ac11d563effa5c8379d062c8fd1615a9db567abf7f1548528847af12f084ce20b16e7e654854ddcd857e0082ea677f41356fcf2c33bb5d
|
data/.github/workflows/ruby.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
### 0.3.2 / 2022-12-02
|
2
|
+
|
3
|
+
* Ensure all character Strings within the {Chars} character sets are encoded as
|
4
|
+
ASCII-8bit. This prevents transcoding issues when calling
|
5
|
+
`Chars::ASCII.random_string(length)`.
|
6
|
+
* Changed {Chars::CharSet#initialize} to encode bytes greater than 256 as UTF-8.
|
7
|
+
Otherwise, bytes less than 256 will be encoded as ASCII-8bit.
|
8
|
+
|
9
|
+
### 0.3.1 / 2022-12-01
|
10
|
+
|
11
|
+
* Removed the space character from {Chars::PUNCTUATION}, as spaces are not
|
12
|
+
technically a punctuation character.
|
13
|
+
* Removed `\f`, `\n`, `\r`, `\t`, and `\v` from {Chars::PRINTABLE}, as other
|
14
|
+
whitespace characters besides space (`' '`) are not considered printable
|
15
|
+
characters.
|
16
|
+
|
1
17
|
### 0.3.0 / 2021-10-23
|
2
18
|
|
3
19
|
* Added {Chars::WHITESPACE}.
|
@@ -22,7 +38,7 @@
|
|
22
38
|
|
23
39
|
### 0.2.2 / 2012-05-28
|
24
40
|
|
25
|
-
* {Chars::CharSet#initialize} now raises a TypeError when given arguments
|
41
|
+
* {Chars::CharSet#initialize} now raises a `TypeError` when given arguments
|
26
42
|
that were neither a `String`, `Integer` or `Enumerable`.
|
27
43
|
* Allow {Chars::CharSet#strings_in} to yield results as they are found.
|
28
44
|
* Improved the performance of {Chars::CharSet#strings_in} when operating on
|
@@ -46,20 +62,21 @@
|
|
46
62
|
|
47
63
|
### 0.1.2 / 2009-09-21
|
48
64
|
|
49
|
-
* Require
|
50
|
-
* Require
|
51
|
-
* Require
|
52
|
-
* Added Chars.visibile and Chars::VISIBLE (thanks flatline).
|
53
|
-
* Added CharSet#random_distinct_bytes,
|
54
|
-
and CharSet#random_distinct_string
|
55
|
-
|
65
|
+
* Require `hoe` >= 2.3.3.
|
66
|
+
* Require `yard` >= 0.2.3.5.
|
67
|
+
* Require `rspec` >= 1.2.8.
|
68
|
+
* Added {Chars.visibile} and {Chars::VISIBLE} (thanks flatline).
|
69
|
+
* Added {Chars::CharSet#random_distinct_bytes},
|
70
|
+
{Chars::CharSet#random_distinct_chars}, and {CharSet#random_distinct_string}
|
71
|
+
(thanks flatline).
|
72
|
+
* Use `hoe/signing` for signed RubyGems.
|
56
73
|
* Moved to YARD based documentation.
|
57
74
|
* All specs now pass on JRuby 1.3.1.
|
58
75
|
|
59
76
|
### 0.1.1 / 2009-04-01
|
60
77
|
|
61
|
-
* Renamed CharSet#=~ to CharSet
|
62
|
-
* Added an alias from CharSet
|
78
|
+
* Renamed {Chars::CharSet#=~} to {Chars::CharSet#===}.
|
79
|
+
* Added an alias from `Chars::CharSet#=~` to {Chars::CharSet#===}.
|
63
80
|
|
64
81
|
### 0.1.0 / 2009-03-16
|
65
82
|
|
@@ -80,7 +97,7 @@
|
|
80
97
|
* Printable
|
81
98
|
* Control
|
82
99
|
* ASCII
|
83
|
-
* Provides convenience methods for testing
|
100
|
+
* Provides convenience methods for testing whether a `String` or `Integer`
|
84
101
|
belongs to a certain character set.
|
85
102
|
* Supports random text generation using specific character sets.
|
86
103
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -23,11 +23,11 @@ recognizing text and generating random text from specific character sets.
|
|
23
23
|
* Lowercase Alpha: `a` - `z`
|
24
24
|
* Alpha: `a` - `z`, `A` - `Z`
|
25
25
|
* Alpha-numeric: `0` - `9`, `a` - `z`, `A` - `Z`
|
26
|
-
* Punctuation: `'
|
27
|
-
* Symbols: `'
|
26
|
+
* Punctuation: `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`
|
27
|
+
* Symbols: `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `_`, `+`, `=`, `|`, `\`, `<`, `>`, `/`
|
28
28
|
* Space: `' '`, `\f`, `\n`, `\r`, `\t`, `\v`
|
29
29
|
* Visible: `0` - `9`, `a` - `z`, `A` - `Z`, `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `_`, `+`, `=`, `|`, `\`, `<`, `>`, `/`
|
30
|
-
* Printable: `0` - `9`, `a` - `z`, `A` - `Z`, `' '`, `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, <code>*</code>, <code>_</code>, `+`, `=`, `|`, `\`, `<`, `>`,
|
30
|
+
* Printable: `0` - `9`, `a` - `z`, `A` - `Z`, `' '`, `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, <code>*</code>, <code>_</code>, `+`, `=`, `|`, `\`, `<`, `>`, `/`
|
31
31
|
* Control: `\x00` - `\x1f`, `\x7f`
|
32
32
|
* Signed ASCII: `\x00` - `\x7f`
|
33
33
|
* ASCII: `\x00` - `\xff`
|
data/gemspec.yml
CHANGED
@@ -15,6 +15,7 @@ metadata:
|
|
15
15
|
source_code_uri: https://github.com/postmodern/chars.rb
|
16
16
|
bug_tracker_uri: https://github.com/postmodern/chars.rb/issues
|
17
17
|
changelog_uri: https://github.com/postmodern/chars.rb/blob/master/ChangeLog.md
|
18
|
+
rubygems_mfa_required: 'true'
|
18
19
|
|
19
20
|
required_ruby_version: ">= 2.0.0"
|
20
21
|
|
data/lib/chars/char_set.rb
CHANGED
@@ -17,7 +17,13 @@ module Chars
|
|
17
17
|
def initialize(*arguments)
|
18
18
|
super()
|
19
19
|
|
20
|
-
@chars = Hash.new
|
20
|
+
@chars = Hash.new do |hash,key|
|
21
|
+
hash[key] = if key > 0xff
|
22
|
+
key.chr(Encoding::UTF_8)
|
23
|
+
else
|
24
|
+
key.chr(Encoding::ASCII_8BIT)
|
25
|
+
end
|
26
|
+
end
|
21
27
|
|
22
28
|
arguments.each do |subset|
|
23
29
|
case subset
|
@@ -44,6 +50,12 @@ module Chars
|
|
44
50
|
#
|
45
51
|
# Creates a new {CharSet}.
|
46
52
|
#
|
53
|
+
# @param [Array<String, Integer, Enumerable>] arguments
|
54
|
+
# The chars for the CharSet.
|
55
|
+
#
|
56
|
+
# @return [CharSet]
|
57
|
+
# The new character set.
|
58
|
+
#
|
47
59
|
# @see #initialize
|
48
60
|
#
|
49
61
|
# @since 0.2.1
|
data/lib/chars/chars.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: ASCII-8BIT
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'chars/char_set'
|
@@ -36,7 +37,7 @@ module Chars
|
|
36
37
|
ALPHA_NUMERIC = ALPHA | NUMERIC
|
37
38
|
|
38
39
|
# The punctuation character set
|
39
|
-
PUNCTUATION = CharSet['
|
40
|
+
PUNCTUATION = CharSet['\'', '"', '`', ',', ';', ':', '~', '-',
|
40
41
|
'(', ')', '[', ']', '{', '}', '.', '?', '!']
|
41
42
|
|
42
43
|
# The symbolic character set
|
@@ -60,7 +61,7 @@ module Chars
|
|
60
61
|
]
|
61
62
|
|
62
63
|
# The set of printable characters (including spaces)
|
63
|
-
PRINTABLE = ALPHA_NUMERIC | PUNCTUATION | SYMBOLS |
|
64
|
+
PRINTABLE = ALPHA_NUMERIC | PUNCTUATION | SYMBOLS | CharSet[' ']
|
64
65
|
|
65
66
|
# The control-char character set
|
66
67
|
CONTROL = CharSet[0..0x1f, 0x7f]
|
@@ -83,6 +84,11 @@ module Chars
|
|
83
84
|
NUMERIC
|
84
85
|
end
|
85
86
|
|
87
|
+
#
|
88
|
+
# Alias for {numeric}.
|
89
|
+
#
|
90
|
+
# @return [CharSet]
|
91
|
+
# The decimal-digit character set.
|
86
92
|
#
|
87
93
|
# @see numeric
|
88
94
|
#
|
@@ -229,6 +235,8 @@ module Chars
|
|
229
235
|
#
|
230
236
|
# The whitespace character set.
|
231
237
|
#
|
238
|
+
# @return [CharSet]
|
239
|
+
#
|
232
240
|
# @see #whitespace
|
233
241
|
#
|
234
242
|
def self.space
|
data/lib/chars/version.rb
CHANGED
data/spec/char_set_spec.rb
CHANGED
@@ -42,6 +42,18 @@ describe Chars::CharSet do
|
|
42
42
|
it "must populate the char set using the Integers as bytes" do
|
43
43
|
expect(integers.all? { |i| subject.include?(i) }).to be(true)
|
44
44
|
end
|
45
|
+
|
46
|
+
it "must encode them as ASCII 8bit Strings" do
|
47
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
48
|
+
end
|
49
|
+
|
50
|
+
context "when one of the Integers is greater than 0xff" do
|
51
|
+
let(:integers) { [0x100, 0xffff] }
|
52
|
+
|
53
|
+
it "must encode the Integer as a UTF-8 String" do
|
54
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::UTF_8))
|
55
|
+
end
|
56
|
+
end
|
45
57
|
end
|
46
58
|
|
47
59
|
context "when given an Array of Integers" do
|
@@ -50,6 +62,18 @@ describe Chars::CharSet do
|
|
50
62
|
it "must populate the char set using the Integers as bytes" do
|
51
63
|
expect(integers.all? { |i| subject.include?(i) }).to be(true)
|
52
64
|
end
|
65
|
+
|
66
|
+
it "must encode them as ASCII 8bit Strings" do
|
67
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
68
|
+
end
|
69
|
+
|
70
|
+
context "when one of the Integers is greater than 0xff" do
|
71
|
+
let(:integers) { [0x100, 0xffff] }
|
72
|
+
|
73
|
+
it "must encode the Integer as a UTF-8 String" do
|
74
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::UTF_8))
|
75
|
+
end
|
76
|
+
end
|
53
77
|
end
|
54
78
|
|
55
79
|
context "when given a Range of Integers" do
|
@@ -58,6 +82,18 @@ describe Chars::CharSet do
|
|
58
82
|
it "must populate the char set by enumerating over the Integer's bytes" do
|
59
83
|
expect(integers.all? { |i| subject.include?(i) }).to be(true)
|
60
84
|
end
|
85
|
+
|
86
|
+
it "must encode them as ASCII 8bit Strings" do
|
87
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
88
|
+
end
|
89
|
+
|
90
|
+
context "when one of the Integers is greater than 0xff" do
|
91
|
+
let(:integer_range) { (0x100..0x200) }
|
92
|
+
|
93
|
+
it "must encode the Integer as a UTF-8 String" do
|
94
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::UTF_8))
|
95
|
+
end
|
96
|
+
end
|
61
97
|
end
|
62
98
|
end
|
63
99
|
|
data/spec/chars_spec.rb
CHANGED
@@ -10,6 +10,10 @@ describe Chars do
|
|
10
10
|
it "must contain numeric characters" do
|
11
11
|
expect(subject.chars).to match_array(numeric_chars)
|
12
12
|
end
|
13
|
+
|
14
|
+
it "must only contain ASCII-8bit encoded characters" do
|
15
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
describe "DIGITS" do
|
@@ -18,6 +22,10 @@ describe Chars do
|
|
18
22
|
it "must equal NUMERIC" do
|
19
23
|
expect(subject).to be(described_class::NUMERIC)
|
20
24
|
end
|
25
|
+
|
26
|
+
it "must only contain ASCII-8bit encoded characters" do
|
27
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
28
|
+
end
|
21
29
|
end
|
22
30
|
|
23
31
|
describe "OCTAL" do
|
@@ -26,6 +34,10 @@ describe Chars do
|
|
26
34
|
it "must contain all octal characters" do
|
27
35
|
expect(subject.chars).to match_array("01234567".chars)
|
28
36
|
end
|
37
|
+
|
38
|
+
it "must only contain ASCII-8bit encoded characters" do
|
39
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
40
|
+
end
|
29
41
|
end
|
30
42
|
|
31
43
|
let(:uppercase_hex_chars) { "0123456789ABCDEF".chars }
|
@@ -36,6 +48,10 @@ describe Chars do
|
|
36
48
|
it "must contain all upper-case hexadecimal characters" do
|
37
49
|
expect(subject.chars).to match_array(uppercase_hex_chars)
|
38
50
|
end
|
51
|
+
|
52
|
+
it "must only contain ASCII-8bit encoded characters" do
|
53
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
54
|
+
end
|
39
55
|
end
|
40
56
|
|
41
57
|
let(:lowercase_hex_chars) { "0123456789abcdef".chars }
|
@@ -46,6 +62,10 @@ describe Chars do
|
|
46
62
|
it "must contain all lower-case hexadecimal characters" do
|
47
63
|
expect(subject.chars).to match_array(lowercase_hex_chars)
|
48
64
|
end
|
65
|
+
|
66
|
+
it "must only contain ASCII-8bit encoded characters" do
|
67
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
68
|
+
end
|
49
69
|
end
|
50
70
|
|
51
71
|
describe "HEXADECIMAL" do
|
@@ -54,6 +74,10 @@ describe Chars do
|
|
54
74
|
it "must contain both upper-case and lower-case hexadecimal characters" do
|
55
75
|
expect(subject.chars).to match_array(uppercase_hex_chars | lowercase_hex_chars)
|
56
76
|
end
|
77
|
+
|
78
|
+
it "must only contain ASCII-8bit encoded characters" do
|
79
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
80
|
+
end
|
57
81
|
end
|
58
82
|
|
59
83
|
let(:uppercase_alpha_chars) { "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars }
|
@@ -64,6 +88,10 @@ describe Chars do
|
|
64
88
|
it "must contain all upper-case alpha characters" do
|
65
89
|
expect(subject.chars).to match_array(uppercase_alpha_chars)
|
66
90
|
end
|
91
|
+
|
92
|
+
it "must only contain ASCII-8bit encoded characters" do
|
93
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
94
|
+
end
|
67
95
|
end
|
68
96
|
|
69
97
|
let(:lowercase_alpha_chars) { "abcdefghijklmnopqrstuvwxyz".chars }
|
@@ -74,6 +102,10 @@ describe Chars do
|
|
74
102
|
it "must contain all lower-case alpha characters" do
|
75
103
|
expect(subject.chars).to match_array(lowercase_alpha_chars)
|
76
104
|
end
|
105
|
+
|
106
|
+
it "must only contain ASCII-8bit encoded characters" do
|
107
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
108
|
+
end
|
77
109
|
end
|
78
110
|
|
79
111
|
let(:alpha_chars) { uppercase_alpha_chars | lowercase_alpha_chars }
|
@@ -84,6 +116,10 @@ describe Chars do
|
|
84
116
|
it "must contain all alpha characters" do
|
85
117
|
expect(subject.chars).to match_array(alpha_chars)
|
86
118
|
end
|
119
|
+
|
120
|
+
it "must only contain ASCII-8bit encoded characters" do
|
121
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
122
|
+
end
|
87
123
|
end
|
88
124
|
|
89
125
|
let(:alpha_numeric_chars) { alpha_chars | numeric_chars }
|
@@ -94,9 +130,13 @@ describe Chars do
|
|
94
130
|
it "must contain all alpha-numeric characters" do
|
95
131
|
expect(subject.chars).to match_array(alpha_numeric_chars)
|
96
132
|
end
|
133
|
+
|
134
|
+
it "must only contain ASCII-8bit encoded characters" do
|
135
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
136
|
+
end
|
97
137
|
end
|
98
138
|
|
99
|
-
let(:punctuation_chars) { "
|
139
|
+
let(:punctuation_chars) { "!\"'(),-.:;?[]`{}~".chars }
|
100
140
|
|
101
141
|
describe "PUNCTUATION" do
|
102
142
|
subject { described_class::PUNCTUATION }
|
@@ -104,9 +144,13 @@ describe Chars do
|
|
104
144
|
it "must contain all punctuation characters" do
|
105
145
|
expect(subject.chars).to match_array(punctuation_chars)
|
106
146
|
end
|
147
|
+
|
148
|
+
it "must only contain ASCII-8bit encoded characters" do
|
149
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
150
|
+
end
|
107
151
|
end
|
108
152
|
|
109
|
-
let(:symbolic_chars) { "
|
153
|
+
let(:symbolic_chars) { "!\"\#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".chars }
|
110
154
|
|
111
155
|
describe "SYMBOLS" do
|
112
156
|
subject { described_class::SYMBOLS }
|
@@ -114,6 +158,10 @@ describe Chars do
|
|
114
158
|
it "must contain all symbolic characters" do
|
115
159
|
expect(subject.chars).to match_array(symbolic_chars)
|
116
160
|
end
|
161
|
+
|
162
|
+
it "must only contain ASCII-8bit encoded characters" do
|
163
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
164
|
+
end
|
117
165
|
end
|
118
166
|
|
119
167
|
let(:whitespace_chars) { "\t\n\v\f\r ".chars }
|
@@ -124,6 +172,10 @@ describe Chars do
|
|
124
172
|
it "must contain all white-space characters" do
|
125
173
|
expect(subject.chars).to match_array(whitespace_chars)
|
126
174
|
end
|
175
|
+
|
176
|
+
it "must only contain ASCII-8bit encoded characters" do
|
177
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
178
|
+
end
|
127
179
|
end
|
128
180
|
|
129
181
|
describe "SPACE" do
|
@@ -132,6 +184,10 @@ describe Chars do
|
|
132
184
|
it "must equal WHITESPACE" do
|
133
185
|
expect(subject).to be(described_class::WHITESPACE)
|
134
186
|
end
|
187
|
+
|
188
|
+
it "must only contain ASCII-8bit encoded characters" do
|
189
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
190
|
+
end
|
135
191
|
end
|
136
192
|
|
137
193
|
describe "VISIBLE" do
|
@@ -140,19 +196,27 @@ describe Chars do
|
|
140
196
|
it "must contain all all alpha-numeric, symbols, and some punctuation" do
|
141
197
|
expect(subject.chars).to match_array(alpha_numeric_chars | "!\"\#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".chars)
|
142
198
|
end
|
199
|
+
|
200
|
+
it "must only contain ASCII-8bit encoded characters" do
|
201
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
202
|
+
end
|
143
203
|
end
|
144
204
|
|
145
205
|
describe "PRINTABLE" do
|
146
206
|
subject { described_class::PRINTABLE }
|
147
207
|
|
148
|
-
it "must contain all alpha-numeric, punctuation, symbols, and
|
208
|
+
it "must contain all alpha-numeric, punctuation, symbols, and space characters" do
|
149
209
|
expect(subject.chars).to match_array(
|
150
210
|
alpha_numeric_chars |
|
151
211
|
punctuation_chars |
|
152
212
|
symbolic_chars |
|
153
|
-
|
213
|
+
[' ']
|
154
214
|
)
|
155
215
|
end
|
216
|
+
|
217
|
+
it "must only contain ASCII-8bit encoded characters" do
|
218
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
219
|
+
end
|
156
220
|
end
|
157
221
|
|
158
222
|
describe "CONTROL" do
|
@@ -161,6 +225,10 @@ describe Chars do
|
|
161
225
|
it "must contain ASCII bytes 0x00 - 0x1f and 0x7f" do
|
162
226
|
expect(subject.bytes).to eq([*0x00..0x1f, 0x7f])
|
163
227
|
end
|
228
|
+
|
229
|
+
it "must only contain ASCII-8bit encoded characters" do
|
230
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
231
|
+
end
|
164
232
|
end
|
165
233
|
|
166
234
|
describe "SIGNED_ASCII" do
|
@@ -169,6 +237,10 @@ describe Chars do
|
|
169
237
|
it "must contain ASCII bytes 0x00 - 0x7f" do
|
170
238
|
expect(subject.bytes).to eq([*0x00..0x7f])
|
171
239
|
end
|
240
|
+
|
241
|
+
it "must only contain ASCII-8bit encoded characters" do
|
242
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
243
|
+
end
|
172
244
|
end
|
173
245
|
|
174
246
|
describe "ASCII" do
|
@@ -177,6 +249,10 @@ describe Chars do
|
|
177
249
|
it "must contain ASCII bytes 0x00 - 0xff" do
|
178
250
|
expect(subject.bytes).to eq([*0x00..0xff])
|
179
251
|
end
|
252
|
+
|
253
|
+
it "must only contain ASCII-8bit encoded characters" do
|
254
|
+
expect(subject.chars.map(&:encoding)).to all(be(Encoding::ASCII_8BIT))
|
255
|
+
end
|
180
256
|
end
|
181
257
|
|
182
258
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,6 +71,7 @@ metadata:
|
|
71
71
|
source_code_uri: https://github.com/postmodern/chars.rb
|
72
72
|
bug_tracker_uri: https://github.com/postmodern/chars.rb/issues
|
73
73
|
changelog_uri: https://github.com/postmodern/chars.rb/blob/master/ChangeLog.md
|
74
|
+
rubygems_mfa_required: 'true'
|
74
75
|
post_install_message:
|
75
76
|
rdoc_options: []
|
76
77
|
require_paths:
|
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
87
|
- !ruby/object:Gem::Version
|
87
88
|
version: '0'
|
88
89
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.3.26
|
90
91
|
signing_key:
|
91
92
|
specification_version: 4
|
92
93
|
summary: A Ruby library for working with various character sets
|