ruby-marc-spec 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/build.yml +18 -0
  3. data/.gitignore +388 -0
  4. data/.gitmodules +3 -0
  5. data/.idea/codeStyles/codeStyleConfig.xml +5 -0
  6. data/.idea/go.imports.xml +6 -0
  7. data/.idea/inspectionProfiles/Project_Default.xml +23 -0
  8. data/.idea/marc_spec.iml +102 -0
  9. data/.idea/misc.xml +6 -0
  10. data/.idea/modules.xml +8 -0
  11. data/.idea/templateLanguages.xml +6 -0
  12. data/.idea/vcs.xml +7 -0
  13. data/.rubocop.yml +269 -0
  14. data/.ruby-version +1 -0
  15. data/.simplecov +8 -0
  16. data/CHANGES.md +3 -0
  17. data/Gemfile +6 -0
  18. data/LICENSE.md +21 -0
  19. data/README.md +172 -0
  20. data/Rakefile +20 -0
  21. data/lib/.rubocop.yml +5 -0
  22. data/lib/marc/spec/module_info.rb +14 -0
  23. data/lib/marc/spec/parsing/closed_int_range.rb +28 -0
  24. data/lib/marc/spec/parsing/closed_lc_alpha_range.rb +28 -0
  25. data/lib/marc/spec/parsing/parser.rb +213 -0
  26. data/lib/marc/spec/parsing.rb +1 -0
  27. data/lib/marc/spec/queries/al_num_range.rb +105 -0
  28. data/lib/marc/spec/queries/applicable.rb +18 -0
  29. data/lib/marc/spec/queries/character_spec.rb +81 -0
  30. data/lib/marc/spec/queries/comparison_string.rb +45 -0
  31. data/lib/marc/spec/queries/condition.rb +133 -0
  32. data/lib/marc/spec/queries/condition_context.rb +49 -0
  33. data/lib/marc/spec/queries/dsl.rb +80 -0
  34. data/lib/marc/spec/queries/indicator_value.rb +77 -0
  35. data/lib/marc/spec/queries/operator.rb +129 -0
  36. data/lib/marc/spec/queries/part.rb +63 -0
  37. data/lib/marc/spec/queries/position.rb +59 -0
  38. data/lib/marc/spec/queries/position_or_range.rb +27 -0
  39. data/lib/marc/spec/queries/query.rb +94 -0
  40. data/lib/marc/spec/queries/query_executor.rb +52 -0
  41. data/lib/marc/spec/queries/selector.rb +12 -0
  42. data/lib/marc/spec/queries/subfield.rb +88 -0
  43. data/lib/marc/spec/queries/subfield_value.rb +63 -0
  44. data/lib/marc/spec/queries/tag.rb +107 -0
  45. data/lib/marc/spec/queries/transform.rb +154 -0
  46. data/lib/marc/spec/queries.rb +1 -0
  47. data/lib/marc/spec.rb +32 -0
  48. data/rakelib/.rubocop.yml +19 -0
  49. data/rakelib/bundle.rake +8 -0
  50. data/rakelib/coverage.rake +11 -0
  51. data/rakelib/gem.rake +54 -0
  52. data/rakelib/parser_specs/formatter.rb +31 -0
  53. data/rakelib/parser_specs/parser_specs.rb.txt.erb +35 -0
  54. data/rakelib/parser_specs/rule.rb +95 -0
  55. data/rakelib/parser_specs/suite.rb +91 -0
  56. data/rakelib/parser_specs/test.rb +97 -0
  57. data/rakelib/parser_specs.rb +1 -0
  58. data/rakelib/rubocop.rake +18 -0
  59. data/rakelib/spec.rake +27 -0
  60. data/ruby-marc-spec.gemspec +42 -0
  61. data/spec/.rubocop.yml +46 -0
  62. data/spec/README.md +16 -0
  63. data/spec/data/b23161018-sru.xml +182 -0
  64. data/spec/data/sandburg.xml +82 -0
  65. data/spec/generated/char_indicator_spec.rb +174 -0
  66. data/spec/generated/char_spec.rb +113 -0
  67. data/spec/generated/comparison_string_spec.rb +74 -0
  68. data/spec/generated/field_tag_spec.rb +156 -0
  69. data/spec/generated/index_char_spec.rb +669 -0
  70. data/spec/generated/index_indicator_spec.rb +174 -0
  71. data/spec/generated/index_spec.rb +113 -0
  72. data/spec/generated/index_sub_spec_spec.rb +1087 -0
  73. data/spec/generated/indicators_spec.rb +75 -0
  74. data/spec/generated/position_or_range_spec.rb +110 -0
  75. data/spec/generated/sub_spec_spec.rb +208 -0
  76. data/spec/generated/sub_spec_sub_spec_spec.rb +1829 -0
  77. data/spec/generated/subfield_char_spec.rb +405 -0
  78. data/spec/generated/subfield_range_range_spec.rb +48 -0
  79. data/spec/generated/subfield_range_spec.rb +87 -0
  80. data/spec/generated/subfield_range_sub_spec_spec.rb +214 -0
  81. data/spec/generated/subfield_tag_range_spec.rb +477 -0
  82. data/spec/generated/subfield_tag_sub_spec_spec.rb +3216 -0
  83. data/spec/generated/subfield_tag_tag_spec.rb +5592 -0
  84. data/spec/marc/spec/parsing/closed_int_range_spec.rb +49 -0
  85. data/spec/marc/spec/parsing/closed_lc_alpha_range_spec.rb +49 -0
  86. data/spec/marc/spec/parsing/parser_spec.rb +545 -0
  87. data/spec/marc/spec/queries/al_num_range_spec.rb +114 -0
  88. data/spec/marc/spec/queries/character_spec_spec.rb +28 -0
  89. data/spec/marc/spec/queries/comparison_string_spec.rb +28 -0
  90. data/spec/marc/spec/queries/indicator_value_spec.rb +28 -0
  91. data/spec/marc/spec/queries/query_spec.rb +200 -0
  92. data/spec/marc/spec/queries/subfield_spec.rb +92 -0
  93. data/spec/marc/spec/queries/subfield_value_spec.rb +31 -0
  94. data/spec/marc/spec/queries/tag_spec.rb +144 -0
  95. data/spec/marc/spec/queries/transform_spec.rb +459 -0
  96. data/spec/marc_spec_spec.rb +247 -0
  97. data/spec/scratch_spec.rb +112 -0
  98. data/spec/spec_helper.rb +23 -0
  99. metadata +341 -0
@@ -0,0 +1,1087 @@
1
+ require 'spec_helper'
2
+ require 'parslet/rig/rspec'
3
+
4
+ module MARC
5
+ module Spec
6
+ module Parsing
7
+ context 'suite' do
8
+ describe :index_sub_spec do
9
+ let(:parser) { Parser.new }
10
+ let(:reporter) { Parslet::ErrorReporter::Deepest.new }
11
+
12
+ describe 'marc_spec: valid field tag, index and subspec' do
13
+ # /valid/wildCombination_validIndexSubSpec.json
14
+
15
+ describe 'last position' do
16
+
17
+ it '&& all digits -> valid' do
18
+ # /valid/wildCombination_validIndexSubSpec.json
19
+ expect(parser.marc_spec).to parse('...[#]{$a~\\Poe}', trace: true, reporter: reporter)
20
+ end
21
+
22
+ it '&& all lowercase chars -> valid' do
23
+ # /valid/wildCombination_validIndexSubSpec.json
24
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\{}', trace: true, reporter: reporter)
25
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\~}', trace: true, reporter: reporter)
26
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\?}', trace: true, reporter: reporter)
27
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\|}', trace: true, reporter: reporter)
28
+ end
29
+
30
+ it '&& all uppercase chars special leader -> valid' do
31
+ # /valid/wildCombination_validIndexSubSpec.json
32
+ expect(parser.marc_spec).to parse('...[#]{$a!~\\Poe}', trace: true, reporter: reporter)
33
+ end
34
+
35
+ it '&& all wildcards -> valid' do
36
+ # /valid/wildCombination_validIndexSubSpec.json
37
+ expect(parser.marc_spec).to parse('...[#]{245$a}', trace: true, reporter: reporter)
38
+ end
39
+
40
+ it '&& mix one lowercase char and two digits -> valid' do
41
+ # /valid/wildCombination_validIndexSubSpec.json
42
+ expect(parser.marc_spec).to parse('...[#]{$a|$b|$c}', trace: true, reporter: reporter)
43
+ end
44
+
45
+ it '&& mix two lowercase chars and one digit -> valid' do
46
+ # /valid/wildCombination_validIndexSubSpec.json
47
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\$}', trace: true, reporter: reporter)
48
+ end
49
+
50
+ it '&& one digit two wildcards right -> valid' do
51
+ # /valid/wildCombination_validIndexSubSpec.json
52
+ expect(parser.marc_spec).to parse('...[#]{$a!=$b}', trace: true, reporter: reporter)
53
+ end
54
+
55
+ it '&& one lowercase and two wildcards right -> valid' do
56
+ # /valid/wildCombination_validIndexSubSpec.json
57
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\=}', trace: true, reporter: reporter)
58
+ end
59
+
60
+ it '&& one uppercase char two wildcards right -> valid' do
61
+ # /valid/wildCombination_validIndexSubSpec.json
62
+ expect(parser.marc_spec).to parse('...[#]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
63
+ end
64
+
65
+ it '&& one wildcard between uppercase chars -> valid' do
66
+ # /valid/wildCombination_validIndexSubSpec.json
67
+ expect(parser.marc_spec).to parse('...[#]{$a}{$b|$c}', trace: true, reporter: reporter)
68
+ end
69
+
70
+ it '&& one wildcard left and two lowercase chars -> valid' do
71
+ # /valid/wildCombination_validIndexSubSpec.json
72
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\!}', trace: true, reporter: reporter)
73
+ end
74
+
75
+ it '&& one wildcard left two uppercase chars -> valid' do
76
+ # /valid/wildCombination_validIndexSubSpec.json
77
+ expect(parser.marc_spec).to parse('...[#]{$a|$b}{$c}', trace: true, reporter: reporter)
78
+ end
79
+
80
+ it '&& one wildcard left with two digits -> valid' do
81
+ # /valid/wildCombination_validIndexSubSpec.json
82
+ expect(parser.marc_spec).to parse('...[#]{?$a}', trace: true, reporter: reporter)
83
+ end
84
+
85
+ it '&& two digits wildcard right -> valid' do
86
+ # /valid/wildCombination_validIndexSubSpec.json
87
+ expect(parser.marc_spec).to parse('...[#]{$a=$b}', trace: true, reporter: reporter)
88
+ end
89
+
90
+ it '&& two wildcards and one lowercase char right -> valid' do
91
+ # /valid/wildCombination_validIndexSubSpec.json
92
+ expect(parser.marc_spec).to parse('...[#]{$a~\\test\\}}', trace: true, reporter: reporter)
93
+ end
94
+
95
+ it '&& two wildcards left one uppercase char -> valid' do
96
+ # /valid/wildCombination_validIndexSubSpec.json
97
+ expect(parser.marc_spec).to parse('...[#]{/#=\\/}', trace: true, reporter: reporter)
98
+ end
99
+
100
+ it '&& two wildcards left with digit -> valid' do
101
+ # /valid/wildCombination_validIndexSubSpec.json
102
+ expect(parser.marc_spec).to parse('...[#]{$a}', trace: true, reporter: reporter)
103
+ end
104
+
105
+ it '&& wildcard between digits -> valid' do
106
+ # /valid/wildCombination_validIndexSubSpec.json
107
+ expect(parser.marc_spec).to parse('...[#]{!$a}', trace: true, reporter: reporter)
108
+ end
109
+
110
+ end
111
+
112
+ describe 'first position' do
113
+
114
+ it '&& all digits -> valid' do
115
+ # /valid/wildCombination_validIndexSubSpec.json
116
+ expect(parser.marc_spec).to parse('...[0]{$a~\\Poe}', trace: true, reporter: reporter)
117
+ end
118
+
119
+ it '&& all lowercase chars -> valid' do
120
+ # /valid/wildCombination_validIndexSubSpec.json
121
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\{}', trace: true, reporter: reporter)
122
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\~}', trace: true, reporter: reporter)
123
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\?}', trace: true, reporter: reporter)
124
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\|}', trace: true, reporter: reporter)
125
+ end
126
+
127
+ it '&& all uppercase chars special leader -> valid' do
128
+ # /valid/wildCombination_validIndexSubSpec.json
129
+ expect(parser.marc_spec).to parse('...[0]{$a!~\\Poe}', trace: true, reporter: reporter)
130
+ end
131
+
132
+ it '&& all wildcards -> valid' do
133
+ # /valid/wildCombination_validIndexSubSpec.json
134
+ expect(parser.marc_spec).to parse('...[0]{245$a}', trace: true, reporter: reporter)
135
+ end
136
+
137
+ it '&& mix one lowercase char and two digits -> valid' do
138
+ # /valid/wildCombination_validIndexSubSpec.json
139
+ expect(parser.marc_spec).to parse('...[0]{$a|$b|$c}', trace: true, reporter: reporter)
140
+ end
141
+
142
+ it '&& mix two lowercase chars and one digit -> valid' do
143
+ # /valid/wildCombination_validIndexSubSpec.json
144
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\$}', trace: true, reporter: reporter)
145
+ end
146
+
147
+ it '&& one digit two wildcards right -> valid' do
148
+ # /valid/wildCombination_validIndexSubSpec.json
149
+ expect(parser.marc_spec).to parse('...[0]{$a!=$b}', trace: true, reporter: reporter)
150
+ end
151
+
152
+ it '&& one lowercase and two wildcards right -> valid' do
153
+ # /valid/wildCombination_validIndexSubSpec.json
154
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\=}', trace: true, reporter: reporter)
155
+ end
156
+
157
+ it '&& one uppercase char two wildcards right -> valid' do
158
+ # /valid/wildCombination_validIndexSubSpec.json
159
+ expect(parser.marc_spec).to parse('...[0]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
160
+ end
161
+
162
+ it '&& one wildcard between uppercase chars -> valid' do
163
+ # /valid/wildCombination_validIndexSubSpec.json
164
+ expect(parser.marc_spec).to parse('...[0]{$a}{$b|$c}', trace: true, reporter: reporter)
165
+ end
166
+
167
+ it '&& one wildcard left and two lowercase chars -> valid' do
168
+ # /valid/wildCombination_validIndexSubSpec.json
169
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\!}', trace: true, reporter: reporter)
170
+ end
171
+
172
+ it '&& one wildcard left two uppercase chars -> valid' do
173
+ # /valid/wildCombination_validIndexSubSpec.json
174
+ expect(parser.marc_spec).to parse('...[0]{$a|$b}{$c}', trace: true, reporter: reporter)
175
+ end
176
+
177
+ it '&& one wildcard left with two digits -> valid' do
178
+ # /valid/wildCombination_validIndexSubSpec.json
179
+ expect(parser.marc_spec).to parse('...[0]{?$a}', trace: true, reporter: reporter)
180
+ end
181
+
182
+ it '&& two digits wildcard right -> valid' do
183
+ # /valid/wildCombination_validIndexSubSpec.json
184
+ expect(parser.marc_spec).to parse('...[0]{$a=$b}', trace: true, reporter: reporter)
185
+ end
186
+
187
+ it '&& two wildcards and one lowercase char right -> valid' do
188
+ # /valid/wildCombination_validIndexSubSpec.json
189
+ expect(parser.marc_spec).to parse('...[0]{$a~\\test\\}}', trace: true, reporter: reporter)
190
+ end
191
+
192
+ it '&& two wildcards left one uppercase char -> valid' do
193
+ # /valid/wildCombination_validIndexSubSpec.json
194
+ expect(parser.marc_spec).to parse('...[0]{/#=\\/}', trace: true, reporter: reporter)
195
+ end
196
+
197
+ it '&& two wildcards left with digit -> valid' do
198
+ # /valid/wildCombination_validIndexSubSpec.json
199
+ expect(parser.marc_spec).to parse('...[0]{$a}', trace: true, reporter: reporter)
200
+ end
201
+
202
+ it '&& wildcard between digits -> valid' do
203
+ # /valid/wildCombination_validIndexSubSpec.json
204
+ expect(parser.marc_spec).to parse('...[0]{!$a}', trace: true, reporter: reporter)
205
+ end
206
+
207
+ end
208
+
209
+ describe 'position ten' do
210
+
211
+ it '&& all digits -> valid' do
212
+ # /valid/wildCombination_validIndexSubSpec.json
213
+ expect(parser.marc_spec).to parse('...[9]{$a~\\Poe}', trace: true, reporter: reporter)
214
+ end
215
+
216
+ it '&& all lowercase chars -> valid' do
217
+ # /valid/wildCombination_validIndexSubSpec.json
218
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\{}', trace: true, reporter: reporter)
219
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\~}', trace: true, reporter: reporter)
220
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\?}', trace: true, reporter: reporter)
221
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\|}', trace: true, reporter: reporter)
222
+ end
223
+
224
+ it '&& all uppercase chars special leader -> valid' do
225
+ # /valid/wildCombination_validIndexSubSpec.json
226
+ expect(parser.marc_spec).to parse('...[9]{$a!~\\Poe}', trace: true, reporter: reporter)
227
+ end
228
+
229
+ it '&& all wildcards -> valid' do
230
+ # /valid/wildCombination_validIndexSubSpec.json
231
+ expect(parser.marc_spec).to parse('...[9]{245$a}', trace: true, reporter: reporter)
232
+ end
233
+
234
+ it '&& mix one lowercase char and two digits -> valid' do
235
+ # /valid/wildCombination_validIndexSubSpec.json
236
+ expect(parser.marc_spec).to parse('...[9]{$a|$b|$c}', trace: true, reporter: reporter)
237
+ end
238
+
239
+ it '&& mix two lowercase chars and one digit -> valid' do
240
+ # /valid/wildCombination_validIndexSubSpec.json
241
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\$}', trace: true, reporter: reporter)
242
+ end
243
+
244
+ it '&& one digit two wildcards right -> valid' do
245
+ # /valid/wildCombination_validIndexSubSpec.json
246
+ expect(parser.marc_spec).to parse('...[9]{$a!=$b}', trace: true, reporter: reporter)
247
+ end
248
+
249
+ it '&& one lowercase and two wildcards right -> valid' do
250
+ # /valid/wildCombination_validIndexSubSpec.json
251
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\=}', trace: true, reporter: reporter)
252
+ end
253
+
254
+ it '&& one uppercase char two wildcards right -> valid' do
255
+ # /valid/wildCombination_validIndexSubSpec.json
256
+ expect(parser.marc_spec).to parse('...[9]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
257
+ end
258
+
259
+ it '&& one wildcard between uppercase chars -> valid' do
260
+ # /valid/wildCombination_validIndexSubSpec.json
261
+ expect(parser.marc_spec).to parse('...[9]{$a}{$b|$c}', trace: true, reporter: reporter)
262
+ end
263
+
264
+ it '&& one wildcard left and two lowercase chars -> valid' do
265
+ # /valid/wildCombination_validIndexSubSpec.json
266
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\!}', trace: true, reporter: reporter)
267
+ end
268
+
269
+ it '&& one wildcard left two uppercase chars -> valid' do
270
+ # /valid/wildCombination_validIndexSubSpec.json
271
+ expect(parser.marc_spec).to parse('...[9]{$a|$b}{$c}', trace: true, reporter: reporter)
272
+ end
273
+
274
+ it '&& one wildcard left with two digits -> valid' do
275
+ # /valid/wildCombination_validIndexSubSpec.json
276
+ expect(parser.marc_spec).to parse('...[9]{?$a}', trace: true, reporter: reporter)
277
+ end
278
+
279
+ it '&& two digits wildcard right -> valid' do
280
+ # /valid/wildCombination_validIndexSubSpec.json
281
+ expect(parser.marc_spec).to parse('...[9]{$a=$b}', trace: true, reporter: reporter)
282
+ end
283
+
284
+ it '&& two wildcards and one lowercase char right -> valid' do
285
+ # /valid/wildCombination_validIndexSubSpec.json
286
+ expect(parser.marc_spec).to parse('...[9]{$a~\\test\\}}', trace: true, reporter: reporter)
287
+ end
288
+
289
+ it '&& two wildcards left one uppercase char -> valid' do
290
+ # /valid/wildCombination_validIndexSubSpec.json
291
+ expect(parser.marc_spec).to parse('...[9]{/#=\\/}', trace: true, reporter: reporter)
292
+ end
293
+
294
+ it '&& two wildcards left with digit -> valid' do
295
+ # /valid/wildCombination_validIndexSubSpec.json
296
+ expect(parser.marc_spec).to parse('...[9]{$a}', trace: true, reporter: reporter)
297
+ end
298
+
299
+ it '&& wildcard between digits -> valid' do
300
+ # /valid/wildCombination_validIndexSubSpec.json
301
+ expect(parser.marc_spec).to parse('...[9]{!$a}', trace: true, reporter: reporter)
302
+ end
303
+
304
+ end
305
+
306
+ describe 'position eleven' do
307
+
308
+ it '&& all digits -> valid' do
309
+ # /valid/wildCombination_validIndexSubSpec.json
310
+ expect(parser.marc_spec).to parse('...[10]{$a~\\Poe}', trace: true, reporter: reporter)
311
+ end
312
+
313
+ it '&& all lowercase chars -> valid' do
314
+ # /valid/wildCombination_validIndexSubSpec.json
315
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\{}', trace: true, reporter: reporter)
316
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\~}', trace: true, reporter: reporter)
317
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\?}', trace: true, reporter: reporter)
318
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\|}', trace: true, reporter: reporter)
319
+ end
320
+
321
+ it '&& all uppercase chars special leader -> valid' do
322
+ # /valid/wildCombination_validIndexSubSpec.json
323
+ expect(parser.marc_spec).to parse('...[10]{$a!~\\Poe}', trace: true, reporter: reporter)
324
+ end
325
+
326
+ it '&& all wildcards -> valid' do
327
+ # /valid/wildCombination_validIndexSubSpec.json
328
+ expect(parser.marc_spec).to parse('...[10]{245$a}', trace: true, reporter: reporter)
329
+ end
330
+
331
+ it '&& mix one lowercase char and two digits -> valid' do
332
+ # /valid/wildCombination_validIndexSubSpec.json
333
+ expect(parser.marc_spec).to parse('...[10]{$a|$b|$c}', trace: true, reporter: reporter)
334
+ end
335
+
336
+ it '&& mix two lowercase chars and one digit -> valid' do
337
+ # /valid/wildCombination_validIndexSubSpec.json
338
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\$}', trace: true, reporter: reporter)
339
+ end
340
+
341
+ it '&& one digit two wildcards right -> valid' do
342
+ # /valid/wildCombination_validIndexSubSpec.json
343
+ expect(parser.marc_spec).to parse('...[10]{$a!=$b}', trace: true, reporter: reporter)
344
+ end
345
+
346
+ it '&& one lowercase and two wildcards right -> valid' do
347
+ # /valid/wildCombination_validIndexSubSpec.json
348
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\=}', trace: true, reporter: reporter)
349
+ end
350
+
351
+ it '&& one uppercase char two wildcards right -> valid' do
352
+ # /valid/wildCombination_validIndexSubSpec.json
353
+ expect(parser.marc_spec).to parse('...[10]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
354
+ end
355
+
356
+ it '&& one wildcard between uppercase chars -> valid' do
357
+ # /valid/wildCombination_validIndexSubSpec.json
358
+ expect(parser.marc_spec).to parse('...[10]{$a}{$b|$c}', trace: true, reporter: reporter)
359
+ end
360
+
361
+ it '&& one wildcard left and two lowercase chars -> valid' do
362
+ # /valid/wildCombination_validIndexSubSpec.json
363
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\!}', trace: true, reporter: reporter)
364
+ end
365
+
366
+ it '&& one wildcard left two uppercase chars -> valid' do
367
+ # /valid/wildCombination_validIndexSubSpec.json
368
+ expect(parser.marc_spec).to parse('...[10]{$a|$b}{$c}', trace: true, reporter: reporter)
369
+ end
370
+
371
+ it '&& one wildcard left with two digits -> valid' do
372
+ # /valid/wildCombination_validIndexSubSpec.json
373
+ expect(parser.marc_spec).to parse('...[10]{?$a}', trace: true, reporter: reporter)
374
+ end
375
+
376
+ it '&& two digits wildcard right -> valid' do
377
+ # /valid/wildCombination_validIndexSubSpec.json
378
+ expect(parser.marc_spec).to parse('...[10]{$a=$b}', trace: true, reporter: reporter)
379
+ end
380
+
381
+ it '&& two wildcards and one lowercase char right -> valid' do
382
+ # /valid/wildCombination_validIndexSubSpec.json
383
+ expect(parser.marc_spec).to parse('...[10]{$a~\\test\\}}', trace: true, reporter: reporter)
384
+ end
385
+
386
+ it '&& two wildcards left one uppercase char -> valid' do
387
+ # /valid/wildCombination_validIndexSubSpec.json
388
+ expect(parser.marc_spec).to parse('...[10]{/#=\\/}', trace: true, reporter: reporter)
389
+ end
390
+
391
+ it '&& two wildcards left with digit -> valid' do
392
+ # /valid/wildCombination_validIndexSubSpec.json
393
+ expect(parser.marc_spec).to parse('...[10]{$a}', trace: true, reporter: reporter)
394
+ end
395
+
396
+ it '&& wildcard between digits -> valid' do
397
+ # /valid/wildCombination_validIndexSubSpec.json
398
+ expect(parser.marc_spec).to parse('...[10]{!$a}', trace: true, reporter: reporter)
399
+ end
400
+
401
+ end
402
+
403
+ describe 'position 101' do
404
+
405
+ it '&& all digits -> valid' do
406
+ # /valid/wildCombination_validIndexSubSpec.json
407
+ expect(parser.marc_spec).to parse('...[100]{$a~\\Poe}', trace: true, reporter: reporter)
408
+ end
409
+
410
+ it '&& all lowercase chars -> valid' do
411
+ # /valid/wildCombination_validIndexSubSpec.json
412
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\{}', trace: true, reporter: reporter)
413
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\~}', trace: true, reporter: reporter)
414
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\?}', trace: true, reporter: reporter)
415
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\|}', trace: true, reporter: reporter)
416
+ end
417
+
418
+ it '&& all uppercase chars special leader -> valid' do
419
+ # /valid/wildCombination_validIndexSubSpec.json
420
+ expect(parser.marc_spec).to parse('...[100]{$a!~\\Poe}', trace: true, reporter: reporter)
421
+ end
422
+
423
+ it '&& all wildcards -> valid' do
424
+ # /valid/wildCombination_validIndexSubSpec.json
425
+ expect(parser.marc_spec).to parse('...[100]{245$a}', trace: true, reporter: reporter)
426
+ end
427
+
428
+ it '&& mix one lowercase char and two digits -> valid' do
429
+ # /valid/wildCombination_validIndexSubSpec.json
430
+ expect(parser.marc_spec).to parse('...[100]{$a|$b|$c}', trace: true, reporter: reporter)
431
+ end
432
+
433
+ it '&& mix two lowercase chars and one digit -> valid' do
434
+ # /valid/wildCombination_validIndexSubSpec.json
435
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\$}', trace: true, reporter: reporter)
436
+ end
437
+
438
+ it '&& one digit two wildcards right -> valid' do
439
+ # /valid/wildCombination_validIndexSubSpec.json
440
+ expect(parser.marc_spec).to parse('...[100]{$a!=$b}', trace: true, reporter: reporter)
441
+ end
442
+
443
+ it '&& one lowercase and two wildcards right -> valid' do
444
+ # /valid/wildCombination_validIndexSubSpec.json
445
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\=}', trace: true, reporter: reporter)
446
+ end
447
+
448
+ it '&& one uppercase char two wildcards right -> valid' do
449
+ # /valid/wildCombination_validIndexSubSpec.json
450
+ expect(parser.marc_spec).to parse('...[100]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
451
+ end
452
+
453
+ it '&& one wildcard between uppercase chars -> valid' do
454
+ # /valid/wildCombination_validIndexSubSpec.json
455
+ expect(parser.marc_spec).to parse('...[100]{$a}{$b|$c}', trace: true, reporter: reporter)
456
+ end
457
+
458
+ it '&& one wildcard left and two lowercase chars -> valid' do
459
+ # /valid/wildCombination_validIndexSubSpec.json
460
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\!}', trace: true, reporter: reporter)
461
+ end
462
+
463
+ it '&& one wildcard left two uppercase chars -> valid' do
464
+ # /valid/wildCombination_validIndexSubSpec.json
465
+ expect(parser.marc_spec).to parse('...[100]{$a|$b}{$c}', trace: true, reporter: reporter)
466
+ end
467
+
468
+ it '&& one wildcard left with two digits -> valid' do
469
+ # /valid/wildCombination_validIndexSubSpec.json
470
+ expect(parser.marc_spec).to parse('...[100]{?$a}', trace: true, reporter: reporter)
471
+ end
472
+
473
+ it '&& two digits wildcard right -> valid' do
474
+ # /valid/wildCombination_validIndexSubSpec.json
475
+ expect(parser.marc_spec).to parse('...[100]{$a=$b}', trace: true, reporter: reporter)
476
+ end
477
+
478
+ it '&& two wildcards and one lowercase char right -> valid' do
479
+ # /valid/wildCombination_validIndexSubSpec.json
480
+ expect(parser.marc_spec).to parse('...[100]{$a~\\test\\}}', trace: true, reporter: reporter)
481
+ end
482
+
483
+ it '&& two wildcards left one uppercase char -> valid' do
484
+ # /valid/wildCombination_validIndexSubSpec.json
485
+ expect(parser.marc_spec).to parse('...[100]{/#=\\/}', trace: true, reporter: reporter)
486
+ end
487
+
488
+ it '&& two wildcards left with digit -> valid' do
489
+ # /valid/wildCombination_validIndexSubSpec.json
490
+ expect(parser.marc_spec).to parse('...[100]{$a}', trace: true, reporter: reporter)
491
+ end
492
+
493
+ it '&& wildcard between digits -> valid' do
494
+ # /valid/wildCombination_validIndexSubSpec.json
495
+ expect(parser.marc_spec).to parse('...[100]{!$a}', trace: true, reporter: reporter)
496
+ end
497
+
498
+ end
499
+
500
+ describe 'range from first position to second' do
501
+
502
+ it '&& all digits -> valid' do
503
+ # /valid/wildCombination_validIndexSubSpec.json
504
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\Poe}', trace: true, reporter: reporter)
505
+ end
506
+
507
+ it '&& all lowercase chars -> valid' do
508
+ # /valid/wildCombination_validIndexSubSpec.json
509
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\{}', trace: true, reporter: reporter)
510
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\~}', trace: true, reporter: reporter)
511
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\?}', trace: true, reporter: reporter)
512
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\|}', trace: true, reporter: reporter)
513
+ end
514
+
515
+ it '&& all uppercase chars special leader -> valid' do
516
+ # /valid/wildCombination_validIndexSubSpec.json
517
+ expect(parser.marc_spec).to parse('...[0-1]{$a!~\\Poe}', trace: true, reporter: reporter)
518
+ end
519
+
520
+ it '&& all wildcards -> valid' do
521
+ # /valid/wildCombination_validIndexSubSpec.json
522
+ expect(parser.marc_spec).to parse('...[0-1]{245$a}', trace: true, reporter: reporter)
523
+ end
524
+
525
+ it '&& mix one lowercase char and two digits -> valid' do
526
+ # /valid/wildCombination_validIndexSubSpec.json
527
+ expect(parser.marc_spec).to parse('...[0-1]{$a|$b|$c}', trace: true, reporter: reporter)
528
+ end
529
+
530
+ it '&& mix two lowercase chars and one digit -> valid' do
531
+ # /valid/wildCombination_validIndexSubSpec.json
532
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\$}', trace: true, reporter: reporter)
533
+ end
534
+
535
+ it '&& one digit two wildcards right -> valid' do
536
+ # /valid/wildCombination_validIndexSubSpec.json
537
+ expect(parser.marc_spec).to parse('...[0-1]{$a!=$b}', trace: true, reporter: reporter)
538
+ end
539
+
540
+ it '&& one lowercase and two wildcards right -> valid' do
541
+ # /valid/wildCombination_validIndexSubSpec.json
542
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\=}', trace: true, reporter: reporter)
543
+ end
544
+
545
+ it '&& one uppercase char two wildcards right -> valid' do
546
+ # /valid/wildCombination_validIndexSubSpec.json
547
+ expect(parser.marc_spec).to parse('...[0-1]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
548
+ end
549
+
550
+ it '&& one wildcard between uppercase chars -> valid' do
551
+ # /valid/wildCombination_validIndexSubSpec.json
552
+ expect(parser.marc_spec).to parse('...[0-1]{$a}{$b|$c}', trace: true, reporter: reporter)
553
+ end
554
+
555
+ it '&& one wildcard left and two lowercase chars -> valid' do
556
+ # /valid/wildCombination_validIndexSubSpec.json
557
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\!}', trace: true, reporter: reporter)
558
+ end
559
+
560
+ it '&& one wildcard left two uppercase chars -> valid' do
561
+ # /valid/wildCombination_validIndexSubSpec.json
562
+ expect(parser.marc_spec).to parse('...[0-1]{$a|$b}{$c}', trace: true, reporter: reporter)
563
+ end
564
+
565
+ it '&& one wildcard left with two digits -> valid' do
566
+ # /valid/wildCombination_validIndexSubSpec.json
567
+ expect(parser.marc_spec).to parse('...[0-1]{?$a}', trace: true, reporter: reporter)
568
+ end
569
+
570
+ it '&& two digits wildcard right -> valid' do
571
+ # /valid/wildCombination_validIndexSubSpec.json
572
+ expect(parser.marc_spec).to parse('...[0-1]{$a=$b}', trace: true, reporter: reporter)
573
+ end
574
+
575
+ it '&& two wildcards and one lowercase char right -> valid' do
576
+ # /valid/wildCombination_validIndexSubSpec.json
577
+ expect(parser.marc_spec).to parse('...[0-1]{$a~\\test\\}}', trace: true, reporter: reporter)
578
+ end
579
+
580
+ it '&& two wildcards left one uppercase char -> valid' do
581
+ # /valid/wildCombination_validIndexSubSpec.json
582
+ expect(parser.marc_spec).to parse('...[0-1]{/#=\\/}', trace: true, reporter: reporter)
583
+ end
584
+
585
+ it '&& two wildcards left with digit -> valid' do
586
+ # /valid/wildCombination_validIndexSubSpec.json
587
+ expect(parser.marc_spec).to parse('...[0-1]{$a}', trace: true, reporter: reporter)
588
+ end
589
+
590
+ it '&& wildcard between digits -> valid' do
591
+ # /valid/wildCombination_validIndexSubSpec.json
592
+ expect(parser.marc_spec).to parse('...[0-1]{!$a}', trace: true, reporter: reporter)
593
+ end
594
+
595
+ end
596
+
597
+ describe 'range from first position to last' do
598
+
599
+ it '&& all digits -> valid' do
600
+ # /valid/wildCombination_validIndexSubSpec.json
601
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\Poe}', trace: true, reporter: reporter)
602
+ end
603
+
604
+ it '&& all lowercase chars -> valid' do
605
+ # /valid/wildCombination_validIndexSubSpec.json
606
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\{}', trace: true, reporter: reporter)
607
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\~}', trace: true, reporter: reporter)
608
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\?}', trace: true, reporter: reporter)
609
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\|}', trace: true, reporter: reporter)
610
+ end
611
+
612
+ it '&& all uppercase chars special leader -> valid' do
613
+ # /valid/wildCombination_validIndexSubSpec.json
614
+ expect(parser.marc_spec).to parse('...[0-#]{$a!~\\Poe}', trace: true, reporter: reporter)
615
+ end
616
+
617
+ it '&& all wildcards -> valid' do
618
+ # /valid/wildCombination_validIndexSubSpec.json
619
+ expect(parser.marc_spec).to parse('...[0-#]{245$a}', trace: true, reporter: reporter)
620
+ end
621
+
622
+ it '&& mix one lowercase char and two digits -> valid' do
623
+ # /valid/wildCombination_validIndexSubSpec.json
624
+ expect(parser.marc_spec).to parse('...[0-#]{$a|$b|$c}', trace: true, reporter: reporter)
625
+ end
626
+
627
+ it '&& mix two lowercase chars and one digit -> valid' do
628
+ # /valid/wildCombination_validIndexSubSpec.json
629
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\$}', trace: true, reporter: reporter)
630
+ end
631
+
632
+ it '&& one digit two wildcards right -> valid' do
633
+ # /valid/wildCombination_validIndexSubSpec.json
634
+ expect(parser.marc_spec).to parse('...[0-#]{$a!=$b}', trace: true, reporter: reporter)
635
+ end
636
+
637
+ it '&& one lowercase and two wildcards right -> valid' do
638
+ # /valid/wildCombination_validIndexSubSpec.json
639
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\=}', trace: true, reporter: reporter)
640
+ end
641
+
642
+ it '&& one uppercase char two wildcards right -> valid' do
643
+ # /valid/wildCombination_validIndexSubSpec.json
644
+ expect(parser.marc_spec).to parse('...[0-#]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
645
+ end
646
+
647
+ it '&& one wildcard between uppercase chars -> valid' do
648
+ # /valid/wildCombination_validIndexSubSpec.json
649
+ expect(parser.marc_spec).to parse('...[0-#]{$a}{$b|$c}', trace: true, reporter: reporter)
650
+ end
651
+
652
+ it '&& one wildcard left and two lowercase chars -> valid' do
653
+ # /valid/wildCombination_validIndexSubSpec.json
654
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\!}', trace: true, reporter: reporter)
655
+ end
656
+
657
+ it '&& one wildcard left two uppercase chars -> valid' do
658
+ # /valid/wildCombination_validIndexSubSpec.json
659
+ expect(parser.marc_spec).to parse('...[0-#]{$a|$b}{$c}', trace: true, reporter: reporter)
660
+ end
661
+
662
+ it '&& one wildcard left with two digits -> valid' do
663
+ # /valid/wildCombination_validIndexSubSpec.json
664
+ expect(parser.marc_spec).to parse('...[0-#]{?$a}', trace: true, reporter: reporter)
665
+ end
666
+
667
+ it '&& two digits wildcard right -> valid' do
668
+ # /valid/wildCombination_validIndexSubSpec.json
669
+ expect(parser.marc_spec).to parse('...[0-#]{$a=$b}', trace: true, reporter: reporter)
670
+ end
671
+
672
+ it '&& two wildcards and one lowercase char right -> valid' do
673
+ # /valid/wildCombination_validIndexSubSpec.json
674
+ expect(parser.marc_spec).to parse('...[0-#]{$a~\\test\\}}', trace: true, reporter: reporter)
675
+ end
676
+
677
+ it '&& two wildcards left one uppercase char -> valid' do
678
+ # /valid/wildCombination_validIndexSubSpec.json
679
+ expect(parser.marc_spec).to parse('...[0-#]{/#=\\/}', trace: true, reporter: reporter)
680
+ end
681
+
682
+ it '&& two wildcards left with digit -> valid' do
683
+ # /valid/wildCombination_validIndexSubSpec.json
684
+ expect(parser.marc_spec).to parse('...[0-#]{$a}', trace: true, reporter: reporter)
685
+ end
686
+
687
+ it '&& wildcard between digits -> valid' do
688
+ # /valid/wildCombination_validIndexSubSpec.json
689
+ expect(parser.marc_spec).to parse('...[0-#]{!$a}', trace: true, reporter: reporter)
690
+ end
691
+
692
+ end
693
+
694
+ describe 'range from first position to first position, is like first position' do
695
+
696
+ it '&& all digits -> valid' do
697
+ # /valid/wildCombination_validIndexSubSpec.json
698
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\Poe}', trace: true, reporter: reporter)
699
+ end
700
+
701
+ it '&& all lowercase chars -> valid' do
702
+ # /valid/wildCombination_validIndexSubSpec.json
703
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\{}', trace: true, reporter: reporter)
704
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\~}', trace: true, reporter: reporter)
705
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\?}', trace: true, reporter: reporter)
706
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\|}', trace: true, reporter: reporter)
707
+ end
708
+
709
+ it '&& all uppercase chars special leader -> valid' do
710
+ # /valid/wildCombination_validIndexSubSpec.json
711
+ expect(parser.marc_spec).to parse('...[0-0]{$a!~\\Poe}', trace: true, reporter: reporter)
712
+ end
713
+
714
+ it '&& all wildcards -> valid' do
715
+ # /valid/wildCombination_validIndexSubSpec.json
716
+ expect(parser.marc_spec).to parse('...[0-0]{245$a}', trace: true, reporter: reporter)
717
+ end
718
+
719
+ it '&& mix one lowercase char and two digits -> valid' do
720
+ # /valid/wildCombination_validIndexSubSpec.json
721
+ expect(parser.marc_spec).to parse('...[0-0]{$a|$b|$c}', trace: true, reporter: reporter)
722
+ end
723
+
724
+ it '&& mix two lowercase chars and one digit -> valid' do
725
+ # /valid/wildCombination_validIndexSubSpec.json
726
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\$}', trace: true, reporter: reporter)
727
+ end
728
+
729
+ it '&& one digit two wildcards right -> valid' do
730
+ # /valid/wildCombination_validIndexSubSpec.json
731
+ expect(parser.marc_spec).to parse('...[0-0]{$a!=$b}', trace: true, reporter: reporter)
732
+ end
733
+
734
+ it '&& one lowercase and two wildcards right -> valid' do
735
+ # /valid/wildCombination_validIndexSubSpec.json
736
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\=}', trace: true, reporter: reporter)
737
+ end
738
+
739
+ it '&& one uppercase char two wildcards right -> valid' do
740
+ # /valid/wildCombination_validIndexSubSpec.json
741
+ expect(parser.marc_spec).to parse('...[0-0]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
742
+ end
743
+
744
+ it '&& one wildcard between uppercase chars -> valid' do
745
+ # /valid/wildCombination_validIndexSubSpec.json
746
+ expect(parser.marc_spec).to parse('...[0-0]{$a}{$b|$c}', trace: true, reporter: reporter)
747
+ end
748
+
749
+ it '&& one wildcard left and two lowercase chars -> valid' do
750
+ # /valid/wildCombination_validIndexSubSpec.json
751
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\!}', trace: true, reporter: reporter)
752
+ end
753
+
754
+ it '&& one wildcard left two uppercase chars -> valid' do
755
+ # /valid/wildCombination_validIndexSubSpec.json
756
+ expect(parser.marc_spec).to parse('...[0-0]{$a|$b}{$c}', trace: true, reporter: reporter)
757
+ end
758
+
759
+ it '&& one wildcard left with two digits -> valid' do
760
+ # /valid/wildCombination_validIndexSubSpec.json
761
+ expect(parser.marc_spec).to parse('...[0-0]{?$a}', trace: true, reporter: reporter)
762
+ end
763
+
764
+ it '&& two digits wildcard right -> valid' do
765
+ # /valid/wildCombination_validIndexSubSpec.json
766
+ expect(parser.marc_spec).to parse('...[0-0]{$a=$b}', trace: true, reporter: reporter)
767
+ end
768
+
769
+ it '&& two wildcards and one lowercase char right -> valid' do
770
+ # /valid/wildCombination_validIndexSubSpec.json
771
+ expect(parser.marc_spec).to parse('...[0-0]{$a~\\test\\}}', trace: true, reporter: reporter)
772
+ end
773
+
774
+ it '&& two wildcards left one uppercase char -> valid' do
775
+ # /valid/wildCombination_validIndexSubSpec.json
776
+ expect(parser.marc_spec).to parse('...[0-0]{/#=\\/}', trace: true, reporter: reporter)
777
+ end
778
+
779
+ it '&& two wildcards left with digit -> valid' do
780
+ # /valid/wildCombination_validIndexSubSpec.json
781
+ expect(parser.marc_spec).to parse('...[0-0]{$a}', trace: true, reporter: reporter)
782
+ end
783
+
784
+ it '&& wildcard between digits -> valid' do
785
+ # /valid/wildCombination_validIndexSubSpec.json
786
+ expect(parser.marc_spec).to parse('...[0-0]{!$a}', trace: true, reporter: reporter)
787
+ end
788
+
789
+ end
790
+
791
+ describe 'range from last position to last position, is like last position' do
792
+
793
+ it '&& all digits -> valid' do
794
+ # /valid/wildCombination_validIndexSubSpec.json
795
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\Poe}', trace: true, reporter: reporter)
796
+ end
797
+
798
+ it '&& all lowercase chars -> valid' do
799
+ # /valid/wildCombination_validIndexSubSpec.json
800
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\{}', trace: true, reporter: reporter)
801
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\~}', trace: true, reporter: reporter)
802
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\?}', trace: true, reporter: reporter)
803
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\|}', trace: true, reporter: reporter)
804
+ end
805
+
806
+ it '&& all uppercase chars special leader -> valid' do
807
+ # /valid/wildCombination_validIndexSubSpec.json
808
+ expect(parser.marc_spec).to parse('...[#-#]{$a!~\\Poe}', trace: true, reporter: reporter)
809
+ end
810
+
811
+ it '&& all wildcards -> valid' do
812
+ # /valid/wildCombination_validIndexSubSpec.json
813
+ expect(parser.marc_spec).to parse('...[#-#]{245$a}', trace: true, reporter: reporter)
814
+ end
815
+
816
+ it '&& mix one lowercase char and two digits -> valid' do
817
+ # /valid/wildCombination_validIndexSubSpec.json
818
+ expect(parser.marc_spec).to parse('...[#-#]{$a|$b|$c}', trace: true, reporter: reporter)
819
+ end
820
+
821
+ it '&& mix two lowercase chars and one digit -> valid' do
822
+ # /valid/wildCombination_validIndexSubSpec.json
823
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\$}', trace: true, reporter: reporter)
824
+ end
825
+
826
+ it '&& one digit two wildcards right -> valid' do
827
+ # /valid/wildCombination_validIndexSubSpec.json
828
+ expect(parser.marc_spec).to parse('...[#-#]{$a!=$b}', trace: true, reporter: reporter)
829
+ end
830
+
831
+ it '&& one lowercase and two wildcards right -> valid' do
832
+ # /valid/wildCombination_validIndexSubSpec.json
833
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\=}', trace: true, reporter: reporter)
834
+ end
835
+
836
+ it '&& one uppercase char two wildcards right -> valid' do
837
+ # /valid/wildCombination_validIndexSubSpec.json
838
+ expect(parser.marc_spec).to parse('...[#-#]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
839
+ end
840
+
841
+ it '&& one wildcard between uppercase chars -> valid' do
842
+ # /valid/wildCombination_validIndexSubSpec.json
843
+ expect(parser.marc_spec).to parse('...[#-#]{$a}{$b|$c}', trace: true, reporter: reporter)
844
+ end
845
+
846
+ it '&& one wildcard left and two lowercase chars -> valid' do
847
+ # /valid/wildCombination_validIndexSubSpec.json
848
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\!}', trace: true, reporter: reporter)
849
+ end
850
+
851
+ it '&& one wildcard left two uppercase chars -> valid' do
852
+ # /valid/wildCombination_validIndexSubSpec.json
853
+ expect(parser.marc_spec).to parse('...[#-#]{$a|$b}{$c}', trace: true, reporter: reporter)
854
+ end
855
+
856
+ it '&& one wildcard left with two digits -> valid' do
857
+ # /valid/wildCombination_validIndexSubSpec.json
858
+ expect(parser.marc_spec).to parse('...[#-#]{?$a}', trace: true, reporter: reporter)
859
+ end
860
+
861
+ it '&& two digits wildcard right -> valid' do
862
+ # /valid/wildCombination_validIndexSubSpec.json
863
+ expect(parser.marc_spec).to parse('...[#-#]{$a=$b}', trace: true, reporter: reporter)
864
+ end
865
+
866
+ it '&& two wildcards and one lowercase char right -> valid' do
867
+ # /valid/wildCombination_validIndexSubSpec.json
868
+ expect(parser.marc_spec).to parse('...[#-#]{$a~\\test\\}}', trace: true, reporter: reporter)
869
+ end
870
+
871
+ it '&& two wildcards left one uppercase char -> valid' do
872
+ # /valid/wildCombination_validIndexSubSpec.json
873
+ expect(parser.marc_spec).to parse('...[#-#]{/#=\\/}', trace: true, reporter: reporter)
874
+ end
875
+
876
+ it '&& two wildcards left with digit -> valid' do
877
+ # /valid/wildCombination_validIndexSubSpec.json
878
+ expect(parser.marc_spec).to parse('...[#-#]{$a}', trace: true, reporter: reporter)
879
+ end
880
+
881
+ it '&& wildcard between digits -> valid' do
882
+ # /valid/wildCombination_validIndexSubSpec.json
883
+ expect(parser.marc_spec).to parse('...[#-#]{!$a}', trace: true, reporter: reporter)
884
+ end
885
+
886
+ end
887
+
888
+ describe 'range from last position to position one (index reverted), is like last position' do
889
+
890
+ it '&& all digits -> valid' do
891
+ # /valid/wildCombination_validIndexSubSpec.json
892
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\Poe}', trace: true, reporter: reporter)
893
+ end
894
+
895
+ it '&& all lowercase chars -> valid' do
896
+ # /valid/wildCombination_validIndexSubSpec.json
897
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\{}', trace: true, reporter: reporter)
898
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\~}', trace: true, reporter: reporter)
899
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\?}', trace: true, reporter: reporter)
900
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\|}', trace: true, reporter: reporter)
901
+ end
902
+
903
+ it '&& all uppercase chars special leader -> valid' do
904
+ # /valid/wildCombination_validIndexSubSpec.json
905
+ expect(parser.marc_spec).to parse('...[#-0]{$a!~\\Poe}', trace: true, reporter: reporter)
906
+ end
907
+
908
+ it '&& all wildcards -> valid' do
909
+ # /valid/wildCombination_validIndexSubSpec.json
910
+ expect(parser.marc_spec).to parse('...[#-0]{245$a}', trace: true, reporter: reporter)
911
+ end
912
+
913
+ it '&& mix one lowercase char and two digits -> valid' do
914
+ # /valid/wildCombination_validIndexSubSpec.json
915
+ expect(parser.marc_spec).to parse('...[#-0]{$a|$b|$c}', trace: true, reporter: reporter)
916
+ end
917
+
918
+ it '&& mix two lowercase chars and one digit -> valid' do
919
+ # /valid/wildCombination_validIndexSubSpec.json
920
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\$}', trace: true, reporter: reporter)
921
+ end
922
+
923
+ it '&& one digit two wildcards right -> valid' do
924
+ # /valid/wildCombination_validIndexSubSpec.json
925
+ expect(parser.marc_spec).to parse('...[#-0]{$a!=$b}', trace: true, reporter: reporter)
926
+ end
927
+
928
+ it '&& one lowercase and two wildcards right -> valid' do
929
+ # /valid/wildCombination_validIndexSubSpec.json
930
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\=}', trace: true, reporter: reporter)
931
+ end
932
+
933
+ it '&& one uppercase char two wildcards right -> valid' do
934
+ # /valid/wildCombination_validIndexSubSpec.json
935
+ expect(parser.marc_spec).to parse('...[#-0]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
936
+ end
937
+
938
+ it '&& one wildcard between uppercase chars -> valid' do
939
+ # /valid/wildCombination_validIndexSubSpec.json
940
+ expect(parser.marc_spec).to parse('...[#-0]{$a}{$b|$c}', trace: true, reporter: reporter)
941
+ end
942
+
943
+ it '&& one wildcard left and two lowercase chars -> valid' do
944
+ # /valid/wildCombination_validIndexSubSpec.json
945
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\!}', trace: true, reporter: reporter)
946
+ end
947
+
948
+ it '&& one wildcard left two uppercase chars -> valid' do
949
+ # /valid/wildCombination_validIndexSubSpec.json
950
+ expect(parser.marc_spec).to parse('...[#-0]{$a|$b}{$c}', trace: true, reporter: reporter)
951
+ end
952
+
953
+ it '&& one wildcard left with two digits -> valid' do
954
+ # /valid/wildCombination_validIndexSubSpec.json
955
+ expect(parser.marc_spec).to parse('...[#-0]{?$a}', trace: true, reporter: reporter)
956
+ end
957
+
958
+ it '&& two digits wildcard right -> valid' do
959
+ # /valid/wildCombination_validIndexSubSpec.json
960
+ expect(parser.marc_spec).to parse('...[#-0]{$a=$b}', trace: true, reporter: reporter)
961
+ end
962
+
963
+ it '&& two wildcards and one lowercase char right -> valid' do
964
+ # /valid/wildCombination_validIndexSubSpec.json
965
+ expect(parser.marc_spec).to parse('...[#-0]{$a~\\test\\}}', trace: true, reporter: reporter)
966
+ end
967
+
968
+ it '&& two wildcards left one uppercase char -> valid' do
969
+ # /valid/wildCombination_validIndexSubSpec.json
970
+ expect(parser.marc_spec).to parse('...[#-0]{/#=\\/}', trace: true, reporter: reporter)
971
+ end
972
+
973
+ it '&& two wildcards left with digit -> valid' do
974
+ # /valid/wildCombination_validIndexSubSpec.json
975
+ expect(parser.marc_spec).to parse('...[#-0]{$a}', trace: true, reporter: reporter)
976
+ end
977
+
978
+ it '&& wildcard between digits -> valid' do
979
+ # /valid/wildCombination_validIndexSubSpec.json
980
+ expect(parser.marc_spec).to parse('...[#-0]{!$a}', trace: true, reporter: reporter)
981
+ end
982
+
983
+ end
984
+
985
+ describe 'range from last position to position two (index reverted)' do
986
+
987
+ it '&& all digits -> valid' do
988
+ # /valid/wildCombination_validIndexSubSpec.json
989
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\Poe}', trace: true, reporter: reporter)
990
+ end
991
+
992
+ it '&& all lowercase chars -> valid' do
993
+ # /valid/wildCombination_validIndexSubSpec.json
994
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\{}', trace: true, reporter: reporter)
995
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\~}', trace: true, reporter: reporter)
996
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\?}', trace: true, reporter: reporter)
997
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\|}', trace: true, reporter: reporter)
998
+ end
999
+
1000
+ it '&& all uppercase chars special leader -> valid' do
1001
+ # /valid/wildCombination_validIndexSubSpec.json
1002
+ expect(parser.marc_spec).to parse('...[#-1]{$a!~\\Poe}', trace: true, reporter: reporter)
1003
+ end
1004
+
1005
+ it '&& all wildcards -> valid' do
1006
+ # /valid/wildCombination_validIndexSubSpec.json
1007
+ expect(parser.marc_spec).to parse('...[#-1]{245$a}', trace: true, reporter: reporter)
1008
+ end
1009
+
1010
+ it '&& mix one lowercase char and two digits -> valid' do
1011
+ # /valid/wildCombination_validIndexSubSpec.json
1012
+ expect(parser.marc_spec).to parse('...[#-1]{$a|$b|$c}', trace: true, reporter: reporter)
1013
+ end
1014
+
1015
+ it '&& mix two lowercase chars and one digit -> valid' do
1016
+ # /valid/wildCombination_validIndexSubSpec.json
1017
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\$}', trace: true, reporter: reporter)
1018
+ end
1019
+
1020
+ it '&& one digit two wildcards right -> valid' do
1021
+ # /valid/wildCombination_validIndexSubSpec.json
1022
+ expect(parser.marc_spec).to parse('...[#-1]{$a!=$b}', trace: true, reporter: reporter)
1023
+ end
1024
+
1025
+ it '&& one lowercase and two wildcards right -> valid' do
1026
+ # /valid/wildCombination_validIndexSubSpec.json
1027
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\=}', trace: true, reporter: reporter)
1028
+ end
1029
+
1030
+ it '&& one uppercase char two wildcards right -> valid' do
1031
+ # /valid/wildCombination_validIndexSubSpec.json
1032
+ expect(parser.marc_spec).to parse('...[#-1]{$a|$b}{$c|$d}', trace: true, reporter: reporter)
1033
+ end
1034
+
1035
+ it '&& one wildcard between uppercase chars -> valid' do
1036
+ # /valid/wildCombination_validIndexSubSpec.json
1037
+ expect(parser.marc_spec).to parse('...[#-1]{$a}{$b|$c}', trace: true, reporter: reporter)
1038
+ end
1039
+
1040
+ it '&& one wildcard left and two lowercase chars -> valid' do
1041
+ # /valid/wildCombination_validIndexSubSpec.json
1042
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\!}', trace: true, reporter: reporter)
1043
+ end
1044
+
1045
+ it '&& one wildcard left two uppercase chars -> valid' do
1046
+ # /valid/wildCombination_validIndexSubSpec.json
1047
+ expect(parser.marc_spec).to parse('...[#-1]{$a|$b}{$c}', trace: true, reporter: reporter)
1048
+ end
1049
+
1050
+ it '&& one wildcard left with two digits -> valid' do
1051
+ # /valid/wildCombination_validIndexSubSpec.json
1052
+ expect(parser.marc_spec).to parse('...[#-1]{?$a}', trace: true, reporter: reporter)
1053
+ end
1054
+
1055
+ it '&& two digits wildcard right -> valid' do
1056
+ # /valid/wildCombination_validIndexSubSpec.json
1057
+ expect(parser.marc_spec).to parse('...[#-1]{$a=$b}', trace: true, reporter: reporter)
1058
+ end
1059
+
1060
+ it '&& two wildcards and one lowercase char right -> valid' do
1061
+ # /valid/wildCombination_validIndexSubSpec.json
1062
+ expect(parser.marc_spec).to parse('...[#-1]{$a~\\test\\}}', trace: true, reporter: reporter)
1063
+ end
1064
+
1065
+ it '&& two wildcards left one uppercase char -> valid' do
1066
+ # /valid/wildCombination_validIndexSubSpec.json
1067
+ expect(parser.marc_spec).to parse('...[#-1]{/#=\\/}', trace: true, reporter: reporter)
1068
+ end
1069
+
1070
+ it '&& two wildcards left with digit -> valid' do
1071
+ # /valid/wildCombination_validIndexSubSpec.json
1072
+ expect(parser.marc_spec).to parse('...[#-1]{$a}', trace: true, reporter: reporter)
1073
+ end
1074
+
1075
+ it '&& wildcard between digits -> valid' do
1076
+ # /valid/wildCombination_validIndexSubSpec.json
1077
+ expect(parser.marc_spec).to parse('...[#-1]{!$a}', trace: true, reporter: reporter)
1078
+ end
1079
+
1080
+ end
1081
+
1082
+ end
1083
+ end
1084
+ end
1085
+ end
1086
+ end
1087
+ end