format_engine 0.7.5 → 0.7.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7de75c3d7edeb874f08d60a24eac574aaf43b5bc
4
- data.tar.gz: 1c27046189aaf9bae3697dda5385c8ce8528b660
2
+ SHA256:
3
+ metadata.gz: ec7fa6186a5cf7c6b5f43baac77c50e4bffd20aa5f6cc7c2a374f18fa21af6cd
4
+ data.tar.gz: 7bf6cc704a4166570d2e162e7d019da702a5fd9e070fc194b23b329a806c5dcf
5
5
  SHA512:
6
- metadata.gz: d6d49cbd0ecba6ef8aa43bbf168d156e871e244e5c93024a2db2731cc752fb6400d947a84416b1abdbec847cd4b10951b9fe676f55e6fe9187e544b201e43276
7
- data.tar.gz: 5d737eab6f9944dc491894d887935260345ff0127d171a6d88709835085a0f6f0db8867988bdb983152234b9817a7b8a13b87a3d112dd68e6b6947984bf6cd8e
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).
@@ -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{An engine for string formatting and parsing.}
12
- spec.description = %q{An engine for string formatting and parsing like the strftime and strptime methods.}
13
- spec.homepage = "http://teuthida-technologies.com/"
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 "bundler", "~> 1.7"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency 'minitest', "~> 5.5.1"
27
- spec.add_development_dependency 'minitest_visible', ">= 0.1.1"
28
- spec.add_development_dependency 'rdoc', "~> 4.0.1"
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
@@ -1,5 +1,5 @@
1
1
 
2
2
  module FormatEngine
3
3
  # The version of the format_engine gem.
4
- VERSION = "0.7.5"
4
+ VERSION = "0.7.10".freeze
5
5
  end
data/sire.rb CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  require_relative 'lib/format_engine'
5
5
 
6
- $no_alias_read_line_module = true
7
6
  require 'mini_readline'
8
7
  require 'pp'
9
8
 
@@ -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
- assert_equal(nil, test["%B"])
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)
@@ -1,207 +1,203 @@
1
- require_relative '../lib/format_engine'
2
- gem 'minitest'
3
- require 'minitest/autorun'
4
- require 'minitest_visible'
5
-
6
- class FormatSpecTester < Minitest::Test
7
-
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
- def test_that_it_scans_literal_formats
12
- test = FormatEngine::FormatSpec.new "ABCDEFG!"
13
- assert_equal(Array, test.specs.class)
14
- assert_equal(1, test.specs.length)
15
- assert_equal(FormatEngine::FormatLiteral, test.specs[0].class)
16
- assert_equal("ABCDEFG!", test.specs[0].literal)
17
- end
18
-
19
- def test_that_backslash_quotes
20
- test = FormatEngine::FormatSpec.new "ABC\\%DEFG!"
21
- assert_equal(Array, test.specs.class)
22
- assert_equal(1, test.specs.length)
23
- assert_equal(FormatEngine::FormatLiteral, test.specs[0].class)
24
- assert_equal("ABC%DEFG!", test.specs[0].literal)
25
- end
26
-
27
- def test_that_it_scans_simple_variable_formats
28
- test = FormatEngine::FormatSpec.new "%A"
29
- assert_equal(Array, test.specs.class)
30
- assert_equal(1, test.specs.length)
31
- assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
32
- assert_equal("%A", test.specs[0].format)
33
- assert_equal(nil, test.specs[0].parms)
34
- end
35
-
36
- def test_that_it_scans_set_formats
37
- test = FormatEngine::FormatSpec.new "%[A]"
38
- assert_equal(Array, test.specs.class)
39
- assert_equal(1, test.specs.length)
40
- assert_equal(FormatEngine::FormatSet, test.specs[0].class)
41
- assert_equal("%[", test.specs[0].short_name)
42
- assert_equal("%[A]", test.specs[0].long_name)
43
- assert_equal(/[A]+/, test.specs[0].regex)
44
-
45
- test = FormatEngine::FormatSpec.new "%*[A]"
46
- assert_equal(Array, test.specs.class)
47
- assert_equal(1, test.specs.length)
48
- assert_equal(FormatEngine::FormatSet, test.specs[0].class)
49
- assert_equal("%*[", test.specs[0].short_name)
50
- assert_equal("%*[A]", test.specs[0].long_name)
51
- assert_equal(/[A]+/, test.specs[0].regex)
52
-
53
- test = FormatEngine::FormatSpec.new "%7[A]"
54
- assert_equal(Array, test.specs.class)
55
- assert_equal(1, test.specs.length)
56
- assert_equal(FormatEngine::FormatSet, test.specs[0].class)
57
- assert_equal("%[", test.specs[0].short_name)
58
- assert_equal("%[A]", test.specs[0].long_name)
59
- assert_equal(/[A]{1,7}/, test.specs[0].regex)
60
-
61
- test = FormatEngine::FormatSpec.new "%*7[A]"
62
- assert_equal(Array, test.specs.class)
63
- assert_equal(1, test.specs.length)
64
- assert_equal(FormatEngine::FormatSet, test.specs[0].class)
65
- assert_equal("%*[", test.specs[0].short_name)
66
- assert_equal("%*[A]", test.specs[0].long_name)
67
- assert_equal(/[A]{1,7}/, test.specs[0].regex)
68
- end
69
-
70
- def test_a_mixed_set
71
- test = FormatEngine::FormatSpec.new "%f %l %[age] %a"
72
- assert_equal(Array, test.specs.class)
73
- assert_equal(7, test.specs.length)
74
-
75
- end
76
-
77
- def test_that_it_scans_tab_seperators
78
- test = FormatEngine::FormatSpec.new "%A\t%B"
79
- assert_equal(Array, test.specs.class)
80
- assert_equal(3, test.specs.length)
81
-
82
- assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
83
- assert_equal("%A", test.specs[0].format)
84
- assert_equal(nil, test.specs[0].parms)
85
-
86
- assert_equal(FormatEngine::FormatLiteral, test.specs[1].class)
87
- assert_equal("\t", test.specs[1].literal)
88
-
89
- assert_equal(FormatEngine::FormatVariable, test.specs[2].class)
90
- assert_equal("%B", test.specs[2].format)
91
- assert_equal(nil, test.specs[2].parms)
92
- end
93
-
94
- def test_that_it_scans_option_variable_formats
95
- "~@#&^&*-+=?_<>|".each_char do |char|
96
- test = FormatEngine::FormatSpec.new "%#{char}A"
97
- assert_equal(Array, test.specs.class)
98
- assert_equal(1, test.specs.length)
99
- assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
100
- assert_equal("%#{char}A", test.specs[0].format)
101
- refute(test.specs[0].has_width?)
102
- refute(test.specs[0].has_prec?)
103
- assert_equal("", test.specs[0].width_str)
104
- assert_equal("", test.specs[0].prec_str)
105
- assert_equal("", test.specs[0].parm_str)
106
- end
107
- end
108
-
109
- def test_that_it_scans_single_variable_formats
110
- test = FormatEngine::FormatSpec.new "%123A"
111
- assert_equal(Array, test.specs.class)
112
- assert_equal(1, test.specs.length)
113
- assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
114
- assert_equal("%A", test.specs[0].format)
115
-
116
- assert_equal(Array, test.specs[0].parms.class)
117
- assert_equal(1, test.specs[0].parms.length)
118
- assert_equal("123", test.specs[0].parms[0])
119
- assert(test.specs[0].has_width?)
120
- refute(test.specs[0].has_prec?)
121
- assert_equal("123", test.specs[0].width_str)
122
- assert_equal("", test.specs[0].prec_str)
123
- assert_equal("123", test.specs[0].parm_str)
124
- end
125
-
126
- def test_that_it_scans_double_variable_formats
127
- test = FormatEngine::FormatSpec.new "%123.456A"
128
- assert_equal(Array, test.specs.class)
129
- assert_equal(1, test.specs.length)
130
- assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
131
- assert_equal("%A", test.specs[0].format)
132
-
133
- assert_equal(Array, test.specs[0].parms.class)
134
- assert_equal(2, test.specs[0].parms.length)
135
- assert_equal("123", test.specs[0].parms[0])
136
- assert_equal("456", test.specs[0].parms[1])
137
- assert(test.specs[0].has_width?)
138
- assert(test.specs[0].has_prec?)
139
- assert_equal("123", test.specs[0].width_str)
140
- assert_equal("456", test.specs[0].prec_str)
141
- assert_equal("123.456", test.specs[0].parm_str)
142
- end
143
-
144
- def test_negative_variable_formats
145
- test = FormatEngine::FormatSpec.new "%-123.456A"
146
- assert_equal(Array, test.specs.class)
147
- assert_equal(1, test.specs.length)
148
- assert_equal(FormatEngine::FormatVariable, test.specs[0].class)
149
- assert_equal("%A", test.specs[0].format)
150
-
151
- assert_equal(Array, test.specs[0].parms.class)
152
- assert_equal(2, test.specs[0].parms.length)
153
- assert_equal("-123", test.specs[0].parms[0])
154
- assert_equal("456", test.specs[0].parms[1])
155
- assert(test.specs[0].has_width?)
156
- assert(test.specs[0].has_prec?)
157
- assert_equal("-123", test.specs[0].width_str)
158
- assert_equal("456", test.specs[0].prec_str)
159
- assert_equal("-123.456", test.specs[0].parm_str)
160
- end
161
-
162
- def test_multipart_formats
163
- test = FormatEngine::FormatSpec.new "T(%+02A:%3B:%4.1C)"
164
-
165
- assert_equal(Array, test.specs.class)
166
- assert_equal(7, test.specs.length)
167
-
168
- assert_equal(FormatEngine::FormatLiteral, test.specs[0].class)
169
- assert_equal("T(", test.specs[0].literal)
170
-
171
- assert_equal(FormatEngine::FormatVariable, test.specs[1].class)
172
- assert_equal("%A", test.specs[1].format)
173
- assert_equal(1, test.specs[1].parms.length)
174
- assert_equal("+02", test.specs[1].parms[0])
175
-
176
- assert_equal(FormatEngine::FormatLiteral, test.specs[2].class)
177
- assert_equal(":", test.specs[2].literal)
178
-
179
- assert_equal(FormatEngine::FormatVariable, test.specs[3].class)
180
- assert_equal("%B", test.specs[3].format)
181
- assert_equal(1, test.specs[3].parms.length)
182
- assert_equal("3", test.specs[3].parms[0])
183
-
184
- assert_equal(FormatEngine::FormatLiteral, test.specs[4].class)
185
- assert_equal(":", test.specs[4].literal)
186
-
187
- assert_equal(FormatEngine::FormatVariable, test.specs[5].class)
188
- assert_equal("%C", test.specs[5].format)
189
- assert_equal(2, test.specs[5].parms.length)
190
- assert_equal("4", test.specs[5].parms[0])
191
- assert_equal("1", test.specs[5].parms[1])
192
-
193
- assert_equal(FormatEngine::FormatLiteral, test.specs[6].class)
194
- assert_equal(")", test.specs[6].literal)
195
- end
196
-
197
- def test_that_it_scans_regex_formats
198
- test = FormatEngine::FormatSpec.new "%/ABC/"
199
- assert_equal(Array, test.specs.class)
200
- assert_equal(1, test.specs.length)
201
- assert_equal(FormatEngine::FormatRgx, test.specs[0].class)
202
- assert_equal(/ABC/, test.specs[0].regex)
203
- end
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},
@@ -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+/) },
@@ -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]+/
@@ -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.5
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: 2016-09-23 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
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: '1.7'
26
+ version: 12.3.3
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
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: '10.0'
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.5.1
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.5.1
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: 4.0.1
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: 4.0.1
83
- description: An engine for string formatting and parsing like the strftime and strptime
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: http://teuthida-technologies.com/
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
- rubyforge_project:
149
- rubygems_version: 2.2.2
134
+ rubygems_version: 3.2.17
150
135
  signing_key:
151
136
  specification_version: 4
152
- summary: An engine for string formatting and parsing.
137
+ summary: A meta-engine for creating string formatters and parsers.
153
138
  test_files: []
154
- has_rdoc: