format_engine 0.7.5 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +11 -0
- data/format_engine.gemspec +8 -8
- data/lib/format_engine/version.rb +1 -1
- data/sire.rb +0 -1
- data/tests/engine_base_tests.rb +1 -5
- data/tests/format_engine_tests.rb +0 -4
- data/tests/format_spec_tests.rb +203 -207
- data/tests/formatter_engine_tests.rb +0 -4
- data/tests/literal_spec_tests.rb +0 -4
- data/tests/parser_engine_tests.rb +0 -4
- data/tests/rgx_spec_tests.rb +0 -4
- data/tests/scan_tests.rb +0 -5
- data/tests/set_spec_tests.rb +0 -4
- data/tests/variable_spec_tests.rb +0 -4
- metadata +21 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ec7fa6186a5cf7c6b5f43baac77c50e4bffd20aa5f6cc7c2a374f18fa21af6cd
|
4
|
+
data.tar.gz: 7bf6cc704a4166570d2e162e7d019da702a5fd9e070fc194b23b329a806c5dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c66ccf19b664166fe719b220e12b0497219006c11158c6d1299f576279c568b9fa703ff8f19612d358870f557aa5c249622c8296b5c0c1377a9581d15f73d9d6
|
7
|
+
data.tar.gz: d98b0ab166a013d6af2be1e936fb0b2efc59a442ee4d4104f3690389d89c65b4a29a5c11373c61dbf4d242a1e1981ec2bbb9251fa6e369af8439e24e14424b61
|
data/README.md
CHANGED
@@ -304,3 +304,14 @@ fmt attribute, has itself, the following attributes:
|
|
304
304
|
|
305
305
|
Go to the GitHub repository and raise an issue calling attention to some
|
306
306
|
aspect that could use some TLC or a suggestion or idea.
|
307
|
+
|
308
|
+
## License
|
309
|
+
|
310
|
+
The gem is available as open source under the terms of the
|
311
|
+
[MIT License](./LICENSE.txt).
|
312
|
+
|
313
|
+
## Code of Conduct
|
314
|
+
|
315
|
+
Everyone interacting in the fully_freeze project’s codebases, issue trackers,
|
316
|
+
chat rooms and mailing lists is expected to follow the
|
317
|
+
[code of conduct](./CODE_OF_CONDUCT.md).
|
data/format_engine.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = FormatEngine::VERSION
|
9
9
|
spec.authors = ["Peter Camilleri"]
|
10
10
|
spec.email = ["peter.c.camilleri@gmail.com"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
13
|
-
spec.homepage = "
|
11
|
+
spec.summary = %q{A meta-engine for creating string formatters and parsers.}
|
12
|
+
spec.description = %q{A meta-engine for creating string formatters and parsers like the strftime and strptime methods.}
|
13
|
+
spec.homepage = "https://github.com/PeterCamilleri/format_engine"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
raw_list = `git ls-files`.split($/)
|
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 1.9.3'
|
23
23
|
|
24
|
-
spec.add_development_dependency "
|
25
|
-
spec.add_development_dependency "
|
26
|
-
spec.add_development_dependency 'minitest', "~> 5.
|
27
|
-
spec.add_development_dependency '
|
28
|
-
|
24
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
25
|
+
spec.add_development_dependency "bundler", ">= 2.1.0"
|
26
|
+
spec.add_development_dependency 'minitest', "~> 5.7"
|
27
|
+
spec.add_development_dependency 'rdoc', "~> 5.0"
|
28
|
+
|
29
29
|
end
|
data/sire.rb
CHANGED
data/tests/engine_base_tests.rb
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
class EngineBaseTester < Minitest::Test
|
7
6
|
|
8
|
-
#Track mini-test progress.
|
9
|
-
include MinitestVisible
|
10
|
-
|
11
7
|
def test_that_it_has_a_library
|
12
8
|
test = FormatEngine::Engine.new({"%A" => 42})
|
13
9
|
|
14
10
|
assert_equal(42, test["%A"])
|
15
|
-
|
11
|
+
assert_nil(test["%B"])
|
16
12
|
assert(test[:before])
|
17
13
|
assert(test[:after])
|
18
14
|
assert_equal(3, test.library.length)
|
@@ -1,16 +1,12 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
require_relative '../mocks/demo'
|
7
6
|
|
8
7
|
# A full test of the formatter/parser engine.
|
9
8
|
class FormatEngineTester < Minitest::Test
|
10
9
|
|
11
|
-
#Track mini-test progress.
|
12
|
-
include MinitestVisible
|
13
|
-
|
14
10
|
def test_that_engines_are_returned
|
15
11
|
assert_equal(FormatEngine::Engine, Customer.formatter_engine.class)
|
16
12
|
assert_equal(FormatEngine::Engine, Customer.parser_engine.class)
|
data/tests/format_spec_tests.rb
CHANGED
@@ -1,207 +1,203 @@
|
|
1
|
-
require_relative '../lib/format_engine'
|
2
|
-
gem 'minitest'
|
3
|
-
require 'minitest/autorun'
|
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
|
-
assert_equal(
|
39
|
-
assert_equal(
|
40
|
-
|
41
|
-
|
42
|
-
assert_equal(
|
43
|
-
assert_equal(
|
44
|
-
|
45
|
-
|
46
|
-
assert_equal(
|
47
|
-
assert_equal(
|
48
|
-
|
49
|
-
|
50
|
-
assert_equal(
|
51
|
-
assert_equal(
|
52
|
-
|
53
|
-
|
54
|
-
assert_equal(
|
55
|
-
assert_equal(1, test.specs.
|
56
|
-
|
57
|
-
|
58
|
-
assert_equal(
|
59
|
-
assert_equal(
|
60
|
-
|
61
|
-
|
62
|
-
assert_equal(
|
63
|
-
assert_equal(1, test.specs.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
assert_equal(
|
80
|
-
|
81
|
-
|
82
|
-
assert_equal(FormatEngine::
|
83
|
-
assert_equal("
|
84
|
-
|
85
|
-
|
86
|
-
assert_equal(
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
assert_equal(
|
100
|
-
assert_equal("
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
assert_equal(
|
113
|
-
assert_equal(
|
114
|
-
assert_equal("
|
115
|
-
|
116
|
-
|
117
|
-
assert_equal(
|
118
|
-
assert_equal("
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
assert_equal(
|
130
|
-
assert_equal(
|
131
|
-
assert_equal("
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
assert_equal("123", test.specs[0].
|
136
|
-
assert_equal("456", test.specs[0].
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
test
|
146
|
-
|
147
|
-
assert_equal(
|
148
|
-
assert_equal(
|
149
|
-
assert_equal("
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
assert_equal("-123", test.specs[0].
|
154
|
-
assert_equal("456", test.specs[0].
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
assert_equal(
|
166
|
-
|
167
|
-
|
168
|
-
assert_equal(
|
169
|
-
assert_equal(
|
170
|
-
|
171
|
-
|
172
|
-
assert_equal(
|
173
|
-
assert_equal(
|
174
|
-
|
175
|
-
|
176
|
-
assert_equal(
|
177
|
-
assert_equal(
|
178
|
-
|
179
|
-
|
180
|
-
assert_equal(
|
181
|
-
assert_equal(
|
182
|
-
|
183
|
-
|
184
|
-
assert_equal(
|
185
|
-
assert_equal(
|
186
|
-
|
187
|
-
assert_equal(
|
188
|
-
|
189
|
-
assert_equal(
|
190
|
-
assert_equal("
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
test
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
end
|
1
|
+
require_relative '../lib/format_engine'
|
2
|
+
gem 'minitest'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
|
5
|
+
class FormatSpecTester < Minitest::Test
|
6
|
+
|
7
|
+
def test_that_it_scans_literal_formats
|
8
|
+
test = FormatEngine::FormatSpec.new "ABCDEFG!"
|
9
|
+
assert_equal(Array, test.specs.class)
|
10
|
+
assert_equal(1, test.specs.length)
|
11
|
+
assert_equal(FormatEngine::FormatLiteral, test.specs[0].class)
|
12
|
+
assert_equal("ABCDEFG!", test.specs[0].literal)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_that_backslash_quotes
|
16
|
+
test = FormatEngine::FormatSpec.new "ABC\\%DEFG!"
|
17
|
+
assert_equal(Array, test.specs.class)
|
18
|
+
assert_equal(1, test.specs.length)
|
19
|
+
assert_equal(FormatEngine::FormatLiteral, test.specs[0].class)
|
20
|
+
assert_equal("ABC%DEFG!", test.specs[0].literal)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_that_it_scans_simple_variable_formats
|
24
|
+
test = FormatEngine::FormatSpec.new "%A"
|
25
|
+
assert_equal(Array, test.specs.class)
|
26
|
+
assert_equal(1, test.specs.length)
|
27
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
|
28
|
+
assert_equal("%A", test.specs[0].format)
|
29
|
+
assert_nil(test.specs[0].parms)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_that_it_scans_set_formats
|
33
|
+
test = FormatEngine::FormatSpec.new "%[A]"
|
34
|
+
assert_equal(Array, test.specs.class)
|
35
|
+
assert_equal(1, test.specs.length)
|
36
|
+
assert_equal(FormatEngine::FormatSet, test.specs[0].class)
|
37
|
+
assert_equal("%[", test.specs[0].short_name)
|
38
|
+
assert_equal("%[A]", test.specs[0].long_name)
|
39
|
+
assert_equal(/[A]+/, test.specs[0].regex)
|
40
|
+
|
41
|
+
test = FormatEngine::FormatSpec.new "%*[A]"
|
42
|
+
assert_equal(Array, test.specs.class)
|
43
|
+
assert_equal(1, test.specs.length)
|
44
|
+
assert_equal(FormatEngine::FormatSet, test.specs[0].class)
|
45
|
+
assert_equal("%*[", test.specs[0].short_name)
|
46
|
+
assert_equal("%*[A]", test.specs[0].long_name)
|
47
|
+
assert_equal(/[A]+/, test.specs[0].regex)
|
48
|
+
|
49
|
+
test = FormatEngine::FormatSpec.new "%7[A]"
|
50
|
+
assert_equal(Array, test.specs.class)
|
51
|
+
assert_equal(1, test.specs.length)
|
52
|
+
assert_equal(FormatEngine::FormatSet, test.specs[0].class)
|
53
|
+
assert_equal("%[", test.specs[0].short_name)
|
54
|
+
assert_equal("%[A]", test.specs[0].long_name)
|
55
|
+
assert_equal(/[A]{1,7}/, test.specs[0].regex)
|
56
|
+
|
57
|
+
test = FormatEngine::FormatSpec.new "%*7[A]"
|
58
|
+
assert_equal(Array, test.specs.class)
|
59
|
+
assert_equal(1, test.specs.length)
|
60
|
+
assert_equal(FormatEngine::FormatSet, test.specs[0].class)
|
61
|
+
assert_equal("%*[", test.specs[0].short_name)
|
62
|
+
assert_equal("%*[A]", test.specs[0].long_name)
|
63
|
+
assert_equal(/[A]{1,7}/, test.specs[0].regex)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_a_mixed_set
|
67
|
+
test = FormatEngine::FormatSpec.new "%f %l %[age] %a"
|
68
|
+
assert_equal(Array, test.specs.class)
|
69
|
+
assert_equal(7, test.specs.length)
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_that_it_scans_tab_seperators
|
74
|
+
test = FormatEngine::FormatSpec.new "%A\t%B"
|
75
|
+
assert_equal(Array, test.specs.class)
|
76
|
+
assert_equal(3, test.specs.length)
|
77
|
+
|
78
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
|
79
|
+
assert_equal("%A", test.specs[0].format)
|
80
|
+
assert_nil(test.specs[0].parms)
|
81
|
+
|
82
|
+
assert_equal(FormatEngine::FormatLiteral, test.specs[1].class)
|
83
|
+
assert_equal("\t", test.specs[1].literal)
|
84
|
+
|
85
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[2].class)
|
86
|
+
assert_equal("%B", test.specs[2].format)
|
87
|
+
assert_nil(test.specs[2].parms)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_that_it_scans_option_variable_formats
|
91
|
+
"~@#&^&*-+=?_<>|".each_char do |char|
|
92
|
+
test = FormatEngine::FormatSpec.new "%#{char}A"
|
93
|
+
assert_equal(Array, test.specs.class)
|
94
|
+
assert_equal(1, test.specs.length)
|
95
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
|
96
|
+
assert_equal("%#{char}A", test.specs[0].format)
|
97
|
+
refute(test.specs[0].has_width?)
|
98
|
+
refute(test.specs[0].has_prec?)
|
99
|
+
assert_equal("", test.specs[0].width_str)
|
100
|
+
assert_equal("", test.specs[0].prec_str)
|
101
|
+
assert_equal("", test.specs[0].parm_str)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_that_it_scans_single_variable_formats
|
106
|
+
test = FormatEngine::FormatSpec.new "%123A"
|
107
|
+
assert_equal(Array, test.specs.class)
|
108
|
+
assert_equal(1, test.specs.length)
|
109
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
|
110
|
+
assert_equal("%A", test.specs[0].format)
|
111
|
+
|
112
|
+
assert_equal(Array, test.specs[0].parms.class)
|
113
|
+
assert_equal(1, test.specs[0].parms.length)
|
114
|
+
assert_equal("123", test.specs[0].parms[0])
|
115
|
+
assert(test.specs[0].has_width?)
|
116
|
+
refute(test.specs[0].has_prec?)
|
117
|
+
assert_equal("123", test.specs[0].width_str)
|
118
|
+
assert_equal("", test.specs[0].prec_str)
|
119
|
+
assert_equal("123", test.specs[0].parm_str)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_that_it_scans_double_variable_formats
|
123
|
+
test = FormatEngine::FormatSpec.new "%123.456A"
|
124
|
+
assert_equal(Array, test.specs.class)
|
125
|
+
assert_equal(1, test.specs.length)
|
126
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
|
127
|
+
assert_equal("%A", test.specs[0].format)
|
128
|
+
|
129
|
+
assert_equal(Array, test.specs[0].parms.class)
|
130
|
+
assert_equal(2, test.specs[0].parms.length)
|
131
|
+
assert_equal("123", test.specs[0].parms[0])
|
132
|
+
assert_equal("456", test.specs[0].parms[1])
|
133
|
+
assert(test.specs[0].has_width?)
|
134
|
+
assert(test.specs[0].has_prec?)
|
135
|
+
assert_equal("123", test.specs[0].width_str)
|
136
|
+
assert_equal("456", test.specs[0].prec_str)
|
137
|
+
assert_equal("123.456", test.specs[0].parm_str)
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_negative_variable_formats
|
141
|
+
test = FormatEngine::FormatSpec.new "%-123.456A"
|
142
|
+
assert_equal(Array, test.specs.class)
|
143
|
+
assert_equal(1, test.specs.length)
|
144
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
|
145
|
+
assert_equal("%A", test.specs[0].format)
|
146
|
+
|
147
|
+
assert_equal(Array, test.specs[0].parms.class)
|
148
|
+
assert_equal(2, test.specs[0].parms.length)
|
149
|
+
assert_equal("-123", test.specs[0].parms[0])
|
150
|
+
assert_equal("456", test.specs[0].parms[1])
|
151
|
+
assert(test.specs[0].has_width?)
|
152
|
+
assert(test.specs[0].has_prec?)
|
153
|
+
assert_equal("-123", test.specs[0].width_str)
|
154
|
+
assert_equal("456", test.specs[0].prec_str)
|
155
|
+
assert_equal("-123.456", test.specs[0].parm_str)
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_multipart_formats
|
159
|
+
test = FormatEngine::FormatSpec.new "T(%+02A:%3B:%4.1C)"
|
160
|
+
|
161
|
+
assert_equal(Array, test.specs.class)
|
162
|
+
assert_equal(7, test.specs.length)
|
163
|
+
|
164
|
+
assert_equal(FormatEngine::FormatLiteral, test.specs[0].class)
|
165
|
+
assert_equal("T(", test.specs[0].literal)
|
166
|
+
|
167
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[1].class)
|
168
|
+
assert_equal("%A", test.specs[1].format)
|
169
|
+
assert_equal(1, test.specs[1].parms.length)
|
170
|
+
assert_equal("+02", test.specs[1].parms[0])
|
171
|
+
|
172
|
+
assert_equal(FormatEngine::FormatLiteral, test.specs[2].class)
|
173
|
+
assert_equal(":", test.specs[2].literal)
|
174
|
+
|
175
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[3].class)
|
176
|
+
assert_equal("%B", test.specs[3].format)
|
177
|
+
assert_equal(1, test.specs[3].parms.length)
|
178
|
+
assert_equal("3", test.specs[3].parms[0])
|
179
|
+
|
180
|
+
assert_equal(FormatEngine::FormatLiteral, test.specs[4].class)
|
181
|
+
assert_equal(":", test.specs[4].literal)
|
182
|
+
|
183
|
+
assert_equal(FormatEngine::FormatVariable, test.specs[5].class)
|
184
|
+
assert_equal("%C", test.specs[5].format)
|
185
|
+
assert_equal(2, test.specs[5].parms.length)
|
186
|
+
assert_equal("4", test.specs[5].parms[0])
|
187
|
+
assert_equal("1", test.specs[5].parms[1])
|
188
|
+
|
189
|
+
assert_equal(FormatEngine::FormatLiteral, test.specs[6].class)
|
190
|
+
assert_equal(")", test.specs[6].literal)
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_that_it_scans_regex_formats
|
194
|
+
test = FormatEngine::FormatSpec.new "%/ABC/"
|
195
|
+
assert_equal(Array, test.specs.class)
|
196
|
+
assert_equal(1, test.specs.length)
|
197
|
+
assert_equal(FormatEngine::FormatRgx, test.specs[0].class)
|
198
|
+
assert_equal(/ABC/, test.specs[0].regex)
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
end
|
@@ -1,16 +1,12 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
require_relative '../mocks/test_person_mock'
|
7
6
|
|
8
7
|
# Test the internals of the formatter engine. This is not the normal interface.
|
9
8
|
class FormatterTester < Minitest::Test
|
10
9
|
|
11
|
-
#Track mini-test progress.
|
12
|
-
include MinitestVisible
|
13
|
-
|
14
10
|
def make_formatter
|
15
11
|
FormatEngine::Engine.new(
|
16
12
|
"%a" => lambda {cat "%#{fmt.width_str}d" % src.age},
|
data/tests/literal_spec_tests.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
class LiteralSpecTester < Minitest::Test
|
7
6
|
|
8
|
-
#Track mini-test progress.
|
9
|
-
include MinitestVisible
|
10
|
-
|
11
7
|
def test_that_it_formats
|
12
8
|
spec_info = FormatEngine::SpecInfo.new(nil, "", nil)
|
13
9
|
test = FormatEngine::FormatLiteral.new("Test 1 2 3")
|
@@ -1,16 +1,12 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
require_relative '../mocks/test_person_mock'
|
7
6
|
|
8
7
|
# Test the internals of the parser engine. This is not the normal interface.
|
9
8
|
class ParserTester < Minitest::Test
|
10
9
|
|
11
|
-
#Track mini-test progress.
|
12
|
-
include MinitestVisible
|
13
|
-
|
14
10
|
def make_parser
|
15
11
|
FormatEngine::Engine.new(
|
16
12
|
"%a" => lambda { tmp[:age] = found.to_i if parse(/\d+/) },
|
data/tests/rgx_spec_tests.rb
CHANGED
@@ -3,13 +3,9 @@
|
|
3
3
|
require_relative '../lib/format_engine'
|
4
4
|
gem 'minitest'
|
5
5
|
require 'minitest/autorun'
|
6
|
-
require 'minitest_visible'
|
7
6
|
|
8
7
|
class RgxSpecTester < Minitest::Test
|
9
8
|
|
10
|
-
#Track mini-test progress.
|
11
|
-
include MinitestVisible
|
12
|
-
|
13
9
|
def test_the_parms
|
14
10
|
test = FormatEngine::FormatRgx.new("%/ABC/")
|
15
11
|
assert_equal(0, test.width)
|
data/tests/scan_tests.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
|
-
|
6
4
|
|
7
5
|
# Test the internals of the parser engine. This is not the normal interface.
|
8
6
|
class ScanTester < Minitest::Test
|
9
7
|
|
10
|
-
#Track mini-test progress.
|
11
|
-
include MinitestVisible
|
12
|
-
|
13
8
|
DECIMAL = /[+-]?\d+/
|
14
9
|
HEX = /[+-]?(0[xX])?\h+/
|
15
10
|
OCTAL = /[+-]?(0[oO])?[0-7]+/
|
data/tests/set_spec_tests.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
class SetSpecTester < Minitest::Test
|
7
6
|
|
8
|
-
#Track mini-test progress.
|
9
|
-
include MinitestVisible
|
10
|
-
|
11
7
|
def test_the_parms
|
12
8
|
test = FormatEngine::FormatSet.new("%[ABC]")
|
13
9
|
assert_equal(0, test.width)
|
@@ -1,13 +1,9 @@
|
|
1
1
|
require_relative '../lib/format_engine'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
class VariableSpecTester < Minitest::Test
|
7
6
|
|
8
|
-
#Track mini-test progress.
|
9
|
-
include MinitestVisible
|
10
|
-
|
11
7
|
def test_the_parms
|
12
8
|
test = FormatEngine::FormatVariable.new("%B")
|
13
9
|
refute(test.has_width?)
|
metadata
CHANGED
@@ -1,87 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: format_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 12.3.3
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 12.3.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.1.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.
|
47
|
+
version: '5.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 5.
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest_visible
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.1
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.1
|
54
|
+
version: '5.7'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rdoc
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '5.0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
-
description:
|
84
|
-
methods.
|
68
|
+
version: '5.0'
|
69
|
+
description: A meta-engine for creating string formatters and parsers like the strftime
|
70
|
+
and strptime methods.
|
85
71
|
email:
|
86
72
|
- peter.c.camilleri@gmail.com
|
87
73
|
executables: []
|
@@ -126,7 +112,7 @@ files:
|
|
126
112
|
- tests/scan_tests.rb
|
127
113
|
- tests/set_spec_tests.rb
|
128
114
|
- tests/variable_spec_tests.rb
|
129
|
-
homepage:
|
115
|
+
homepage: https://github.com/PeterCamilleri/format_engine
|
130
116
|
licenses:
|
131
117
|
- MIT
|
132
118
|
metadata: {}
|
@@ -145,10 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
131
|
- !ruby/object:Gem::Version
|
146
132
|
version: '0'
|
147
133
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.2.2
|
134
|
+
rubygems_version: 3.2.17
|
150
135
|
signing_key:
|
151
136
|
specification_version: 4
|
152
|
-
summary:
|
137
|
+
summary: A meta-engine for creating string formatters and parsers.
|
153
138
|
test_files: []
|
154
|
-
has_rdoc:
|