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,174 @@
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 :char_indicator do
9
+ let(:parser) { Parser.new }
10
+ let(:reporter) { Parslet::ErrorReporter::Deepest.new }
11
+
12
+ describe 'marc_spec: valid field tag and charspec' do
13
+ # /invalid/wildCombination_invalidCharIndicator.json
14
+
15
+ describe 'last position' do
16
+
17
+ it '&& indicator 1 -> invalid' do
18
+ # /invalid/wildCombination_invalidCharIndicator.json
19
+ expect(parser.marc_spec).not_to parse('.../#^1', trace: true, reporter: reporter)
20
+ end
21
+
22
+ it '&& indicator 2 -> invalid' do
23
+ # /invalid/wildCombination_invalidCharIndicator.json
24
+ expect(parser.marc_spec).not_to parse('.../#^2', trace: true, reporter: reporter)
25
+ end
26
+
27
+ end
28
+
29
+ describe 'first position' do
30
+
31
+ it '&& indicator 1 -> invalid' do
32
+ # /invalid/wildCombination_invalidCharIndicator.json
33
+ expect(parser.marc_spec).not_to parse('.../0^1', trace: true, reporter: reporter)
34
+ end
35
+
36
+ it '&& indicator 2 -> invalid' do
37
+ # /invalid/wildCombination_invalidCharIndicator.json
38
+ expect(parser.marc_spec).not_to parse('.../0^2', trace: true, reporter: reporter)
39
+ end
40
+
41
+ end
42
+
43
+ describe 'position ten' do
44
+
45
+ it '&& indicator 1 -> invalid' do
46
+ # /invalid/wildCombination_invalidCharIndicator.json
47
+ expect(parser.marc_spec).not_to parse('.../9^1', trace: true, reporter: reporter)
48
+ end
49
+
50
+ it '&& indicator 2 -> invalid' do
51
+ # /invalid/wildCombination_invalidCharIndicator.json
52
+ expect(parser.marc_spec).not_to parse('.../9^2', trace: true, reporter: reporter)
53
+ end
54
+
55
+ end
56
+
57
+ describe 'position eleven' do
58
+
59
+ it '&& indicator 1 -> invalid' do
60
+ # /invalid/wildCombination_invalidCharIndicator.json
61
+ expect(parser.marc_spec).not_to parse('.../10^1', trace: true, reporter: reporter)
62
+ end
63
+
64
+ it '&& indicator 2 -> invalid' do
65
+ # /invalid/wildCombination_invalidCharIndicator.json
66
+ expect(parser.marc_spec).not_to parse('.../10^2', trace: true, reporter: reporter)
67
+ end
68
+
69
+ end
70
+
71
+ describe 'position 101' do
72
+
73
+ it '&& indicator 1 -> invalid' do
74
+ # /invalid/wildCombination_invalidCharIndicator.json
75
+ expect(parser.marc_spec).not_to parse('.../100^1', trace: true, reporter: reporter)
76
+ end
77
+
78
+ it '&& indicator 2 -> invalid' do
79
+ # /invalid/wildCombination_invalidCharIndicator.json
80
+ expect(parser.marc_spec).not_to parse('.../100^2', trace: true, reporter: reporter)
81
+ end
82
+
83
+ end
84
+
85
+ describe 'range from first position to second' do
86
+
87
+ it '&& indicator 1 -> invalid' do
88
+ # /invalid/wildCombination_invalidCharIndicator.json
89
+ expect(parser.marc_spec).not_to parse('.../0-1^1', trace: true, reporter: reporter)
90
+ end
91
+
92
+ it '&& indicator 2 -> invalid' do
93
+ # /invalid/wildCombination_invalidCharIndicator.json
94
+ expect(parser.marc_spec).not_to parse('.../0-1^2', trace: true, reporter: reporter)
95
+ end
96
+
97
+ end
98
+
99
+ describe 'range from first position to last' do
100
+
101
+ it '&& indicator 1 -> invalid' do
102
+ # /invalid/wildCombination_invalidCharIndicator.json
103
+ expect(parser.marc_spec).not_to parse('.../0-#^1', trace: true, reporter: reporter)
104
+ end
105
+
106
+ it '&& indicator 2 -> invalid' do
107
+ # /invalid/wildCombination_invalidCharIndicator.json
108
+ expect(parser.marc_spec).not_to parse('.../0-#^2', trace: true, reporter: reporter)
109
+ end
110
+
111
+ end
112
+
113
+ describe 'range from first position to first position, is like first position' do
114
+
115
+ it '&& indicator 1 -> invalid' do
116
+ # /invalid/wildCombination_invalidCharIndicator.json
117
+ expect(parser.marc_spec).not_to parse('.../0-0^1', trace: true, reporter: reporter)
118
+ end
119
+
120
+ it '&& indicator 2 -> invalid' do
121
+ # /invalid/wildCombination_invalidCharIndicator.json
122
+ expect(parser.marc_spec).not_to parse('.../0-0^2', trace: true, reporter: reporter)
123
+ end
124
+
125
+ end
126
+
127
+ describe 'range from last position to last position, is like last position' do
128
+
129
+ it '&& indicator 1 -> invalid' do
130
+ # /invalid/wildCombination_invalidCharIndicator.json
131
+ expect(parser.marc_spec).not_to parse('.../#-#^1', trace: true, reporter: reporter)
132
+ end
133
+
134
+ it '&& indicator 2 -> invalid' do
135
+ # /invalid/wildCombination_invalidCharIndicator.json
136
+ expect(parser.marc_spec).not_to parse('.../#-#^2', trace: true, reporter: reporter)
137
+ end
138
+
139
+ end
140
+
141
+ describe 'range from last position to position one (index reverted), is like last position' do
142
+
143
+ it '&& indicator 1 -> invalid' do
144
+ # /invalid/wildCombination_invalidCharIndicator.json
145
+ expect(parser.marc_spec).not_to parse('.../#-0^1', trace: true, reporter: reporter)
146
+ end
147
+
148
+ it '&& indicator 2 -> invalid' do
149
+ # /invalid/wildCombination_invalidCharIndicator.json
150
+ expect(parser.marc_spec).not_to parse('.../#-0^2', trace: true, reporter: reporter)
151
+ end
152
+
153
+ end
154
+
155
+ describe 'range from last position to position two (index reverted)' do
156
+
157
+ it '&& indicator 1 -> invalid' do
158
+ # /invalid/wildCombination_invalidCharIndicator.json
159
+ expect(parser.marc_spec).not_to parse('.../#-1^1', trace: true, reporter: reporter)
160
+ end
161
+
162
+ it '&& indicator 2 -> invalid' do
163
+ # /invalid/wildCombination_invalidCharIndicator.json
164
+ expect(parser.marc_spec).not_to parse('.../#-1^2', trace: true, reporter: reporter)
165
+ end
166
+
167
+ end
168
+
169
+ end
170
+ end
171
+ end
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,113 @@
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 :char do
9
+ let(:parser) { Parser.new }
10
+ let(:reporter) { Parslet::ErrorReporter::Deepest.new }
11
+
12
+ describe 'marc_spec: valid field tag and charspec' do
13
+ # /valid/wildCombination_validChar.json
14
+ it 'first position -> valid' do
15
+ # /valid/wildCombination_validChar.json
16
+ expect(parser.marc_spec).to parse('.../0', trace: true, reporter: reporter)
17
+ end
18
+
19
+ it 'last position -> valid' do
20
+ # /valid/wildCombination_validChar.json
21
+ expect(parser.marc_spec).to parse('.../#', trace: true, reporter: reporter)
22
+ end
23
+
24
+ it 'position 101 -> valid' do
25
+ # /valid/wildCombination_validChar.json
26
+ expect(parser.marc_spec).to parse('.../100', trace: true, reporter: reporter)
27
+ end
28
+
29
+ it 'position eleven -> valid' do
30
+ # /valid/wildCombination_validChar.json
31
+ expect(parser.marc_spec).to parse('.../10', trace: true, reporter: reporter)
32
+ end
33
+
34
+ it 'position ten -> valid' do
35
+ # /valid/wildCombination_validChar.json
36
+ expect(parser.marc_spec).to parse('.../9', trace: true, reporter: reporter)
37
+ end
38
+
39
+ it 'range from first position to first position, is like first position -> valid' do
40
+ # /valid/wildCombination_validChar.json
41
+ expect(parser.marc_spec).to parse('.../0-0', trace: true, reporter: reporter)
42
+ end
43
+
44
+ it 'range from first position to last -> valid' do
45
+ # /valid/wildCombination_validChar.json
46
+ expect(parser.marc_spec).to parse('.../0-#', trace: true, reporter: reporter)
47
+ end
48
+
49
+ it 'range from first position to second -> valid' do
50
+ # /valid/wildCombination_validChar.json
51
+ expect(parser.marc_spec).to parse('.../0-1', trace: true, reporter: reporter)
52
+ end
53
+
54
+ it 'range from last position to last position, is like last position -> valid' do
55
+ # /valid/wildCombination_validChar.json
56
+ expect(parser.marc_spec).to parse('.../#-#', trace: true, reporter: reporter)
57
+ end
58
+
59
+ it 'range from last position to position one (index reverted), is like last position -> valid' do
60
+ # /valid/wildCombination_validChar.json
61
+ expect(parser.marc_spec).to parse('.../#-0', trace: true, reporter: reporter)
62
+ end
63
+
64
+ it 'range from last position to position two (index reverted) -> valid' do
65
+ # /valid/wildCombination_validChar.json
66
+ expect(parser.marc_spec).to parse('.../#-1', trace: true, reporter: reporter)
67
+ end
68
+
69
+ end
70
+ describe 'marc_spec: valid field tag and invalid charspec' do
71
+ # /invalid/wildCombination_invalidChar.json
72
+ it 'empty string -> invalid' do
73
+ # /invalid/wildCombination_invalidChar.json
74
+ expect(parser.marc_spec).not_to parse('.../', trace: true, reporter: reporter)
75
+ end
76
+
77
+ it 'missing ending position -> invalid' do
78
+ # /invalid/wildCombination_invalidChar.json
79
+ expect(parser.marc_spec).not_to parse('.../#-', trace: true, reporter: reporter)
80
+ end
81
+
82
+ it 'missing starting position -> invalid' do
83
+ # /invalid/wildCombination_invalidChar.json
84
+ expect(parser.marc_spec).not_to parse('.../-2', trace: true, reporter: reporter)
85
+ end
86
+
87
+ it "only digits, one hyphen and the char '#' are allowed -> invalid" do
88
+ # /invalid/wildCombination_invalidChar.json
89
+ expect(parser.marc_spec).not_to parse('.../1-X', trace: true, reporter: reporter)
90
+ expect(parser.marc_spec).not_to parse('.../?', trace: true, reporter: reporter)
91
+ end
92
+
93
+ it 'only one hyphen allwed -> invalid' do
94
+ # /invalid/wildCombination_invalidChar.json
95
+ expect(parser.marc_spec).not_to parse('.../1-2-', trace: true, reporter: reporter)
96
+ end
97
+
98
+ it 'this matches pattern, but starting position number must not be higher than ending position number -> invalid' do
99
+ # /invalid/wildCombination_invalidChar.json
100
+ expect(parser.marc_spec).not_to parse('.../2-1', trace: true, reporter: reporter)
101
+ end
102
+
103
+ it 'whitespace is not allowed -> invalid' do
104
+ # /invalid/wildCombination_invalidChar.json
105
+ expect(parser.marc_spec).not_to parse('.../1- 2', trace: true, reporter: reporter)
106
+ end
107
+
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,74 @@
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 :comparison_string do
9
+ let(:parser) { Parser.new }
10
+ let(:reporter) { Parslet::ErrorReporter::Deepest.new }
11
+
12
+ describe 'comparison strings are strings and match pattern' do
13
+ # /invalid/invalidComparisonString.json
14
+ it 'subfield with single digit subfieldtag -> valid' do
15
+ # /valid/validComparisonString.json
16
+ expect(parser.comparison_string).to parse('te\\}st', trace: true, reporter: reporter)
17
+ end
18
+
19
+ it 'subfield with single lowercase alpha subfieldtag -> valid' do
20
+ # /valid/validComparisonString.json
21
+ expect(parser.comparison_string).to parse('test\\$', trace: true, reporter: reporter)
22
+ expect(parser.comparison_string).to parse('test\\{', trace: true, reporter: reporter)
23
+ end
24
+
25
+ it 'subfieldrange with lowercase subfieldtags -> valid' do
26
+ # /valid/validComparisonString.json
27
+ expect(parser.comparison_string).to parse('test\\!', trace: true, reporter: reporter)
28
+ expect(parser.comparison_string).to parse('\\=test', trace: true, reporter: reporter)
29
+ expect(parser.comparison_string).to parse('test\\~', trace: true, reporter: reporter)
30
+ expect(parser.comparison_string).to parse('test\\?', trace: true, reporter: reporter)
31
+ expect(parser.comparison_string).to parse('tes\\st\\|', trace: true, reporter: reporter)
32
+ end
33
+
34
+ it "unescaped character '$' -> invalid" do
35
+ # /invalid/invalidComparisonString.json
36
+ expect(parser.comparison_string).not_to parse('test$', trace: true, reporter: reporter)
37
+ end
38
+
39
+ it "unescaped character '=' at beginning is valid -> valid" do
40
+ # /valid/validComparisonString.json
41
+ expect(parser.comparison_string).to parse('=test', trace: true, reporter: reporter)
42
+ end
43
+
44
+ it "unescaped character '?' -> invalid" do
45
+ # /invalid/invalidComparisonString.json
46
+ expect(parser.comparison_string).not_to parse('test?', trace: true, reporter: reporter)
47
+ end
48
+
49
+ it "unescaped character '{' -> invalid" do
50
+ # /invalid/invalidComparisonString.json
51
+ expect(parser.comparison_string).not_to parse('test{', trace: true, reporter: reporter)
52
+ end
53
+
54
+ it "unescaped character '}' -> invalid" do
55
+ # /invalid/invalidComparisonString.json
56
+ expect(parser.comparison_string).not_to parse('te}st', trace: true, reporter: reporter)
57
+ end
58
+
59
+ it "unescaped character '~' -> invalid" do
60
+ # /invalid/invalidComparisonString.json
61
+ expect(parser.comparison_string).not_to parse('test~', trace: true, reporter: reporter)
62
+ end
63
+
64
+ it 'whitespaces are not allowed -> invalid' do
65
+ # /invalid/invalidComparisonString.json
66
+ expect(parser.comparison_string).not_to parse('te st\\?', trace: true, reporter: reporter)
67
+ end
68
+
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,156 @@
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 :field_tag do
9
+ let(:parser) { Parser.new }
10
+ let(:reporter) { Parslet::ErrorReporter::Deepest.new }
11
+
12
+ describe 'field tags are strings and match pattern' do
13
+ # /invalid/invalidFieldTag.json
14
+ it 'all digits -> valid' do
15
+ # /valid/validFieldTag.json
16
+ expect(parser.field_tag).to parse('300', trace: true, reporter: reporter)
17
+ end
18
+
19
+ it 'all lowercase chars -> valid' do
20
+ # /valid/validFieldTag.json
21
+ expect(parser.field_tag).to parse('abc', trace: true, reporter: reporter)
22
+ end
23
+
24
+ it 'all uppercase chars -> valid' do
25
+ # /valid/validFieldTag.json
26
+ expect(parser.field_tag).to parse('ABC', trace: true, reporter: reporter)
27
+ end
28
+
29
+ it 'all uppercase chars special leader -> valid' do
30
+ # /valid/validFieldTag.json
31
+ expect(parser.field_tag).to parse('LDR', trace: true, reporter: reporter)
32
+ end
33
+
34
+ it 'all wildcards -> valid' do
35
+ # /valid/validFieldTag.json
36
+ expect(parser.field_tag).to parse('...', trace: true, reporter: reporter)
37
+ end
38
+
39
+ it 'invalid char # -> invalid' do
40
+ # /invalid/invalidFieldTag.json
41
+ expect(parser.field_tag).not_to parse('24#', trace: true, reporter: reporter)
42
+ end
43
+
44
+ it 'invalid char ? -> invalid' do
45
+ # /invalid/invalidFieldTag.json
46
+ expect(parser.field_tag).not_to parse('?00', trace: true, reporter: reporter)
47
+ end
48
+
49
+ it 'invalid whitespace -> invalid' do
50
+ # /invalid/invalidFieldTag.json
51
+ expect(parser.field_tag).not_to parse('24 ', trace: true, reporter: reporter)
52
+ expect(parser.field_tag).not_to parse('2 5', trace: true, reporter: reporter)
53
+ expect(parser.field_tag).not_to parse(' 45', trace: true, reporter: reporter)
54
+ end
55
+
56
+ it 'mix of digit, lowercase and uppercase chars -> invalid' do
57
+ # /invalid/invalidFieldTag.json
58
+ expect(parser.field_tag).not_to parse('a0C', trace: true, reporter: reporter)
59
+ end
60
+
61
+ it 'mix of lowercase and uppercase chars -> invalid' do
62
+ # /invalid/invalidFieldTag.json
63
+ expect(parser.field_tag).not_to parse('abC', trace: true, reporter: reporter)
64
+ end
65
+
66
+ it 'mix of wildcard, lowercase and uppercase chars -> invalid' do
67
+ # /invalid/invalidFieldTag.json
68
+ expect(parser.field_tag).not_to parse('a.C', trace: true, reporter: reporter)
69
+ end
70
+
71
+ it 'mix one lowercase char and two digits -> valid' do
72
+ # /valid/validFieldTag.json
73
+ expect(parser.field_tag).to parse('a00', trace: true, reporter: reporter)
74
+ end
75
+
76
+ it 'mix two lowercase chars and one digit -> valid' do
77
+ # /valid/validFieldTag.json
78
+ expect(parser.field_tag).to parse('aa0', trace: true, reporter: reporter)
79
+ end
80
+
81
+ it 'one digit two wildcards right -> valid' do
82
+ # /valid/validFieldTag.json
83
+ expect(parser.field_tag).to parse('2..', trace: true, reporter: reporter)
84
+ end
85
+
86
+ it 'one lowercase and two wildcards right -> valid' do
87
+ # /valid/validFieldTag.json
88
+ expect(parser.field_tag).to parse('a..', trace: true, reporter: reporter)
89
+ end
90
+
91
+ it 'one uppercase char two wildcards right -> valid' do
92
+ # /valid/validFieldTag.json
93
+ expect(parser.field_tag).to parse('A..', trace: true, reporter: reporter)
94
+ end
95
+
96
+ it 'one wildcard between uppercase chars -> valid' do
97
+ # /valid/validFieldTag.json
98
+ expect(parser.field_tag).to parse('A.C', trace: true, reporter: reporter)
99
+ end
100
+
101
+ it 'one wildcard left and two lowercase chars -> valid' do
102
+ # /valid/validFieldTag.json
103
+ expect(parser.field_tag).to parse('.bc', trace: true, reporter: reporter)
104
+ end
105
+
106
+ it 'one wildcard left two uppercase chars -> valid' do
107
+ # /valid/validFieldTag.json
108
+ expect(parser.field_tag).to parse('.BC', trace: true, reporter: reporter)
109
+ end
110
+
111
+ it 'one wildcard left with two digits -> valid' do
112
+ # /valid/validFieldTag.json
113
+ expect(parser.field_tag).to parse('.00', trace: true, reporter: reporter)
114
+ end
115
+
116
+ it 'too many chars -> invalid' do
117
+ # /invalid/invalidFieldTag.json
118
+ expect(parser.field_tag).not_to parse('ABCD', trace: true, reporter: reporter)
119
+ end
120
+
121
+ it 'too many wildcards -> invalid' do
122
+ # /invalid/invalidFieldTag.json
123
+ expect(parser.field_tag).not_to parse('....', trace: true, reporter: reporter)
124
+ end
125
+
126
+ it 'two digits wildcard right -> valid' do
127
+ # /valid/validFieldTag.json
128
+ expect(parser.field_tag).to parse('20.', trace: true, reporter: reporter)
129
+ end
130
+
131
+ it 'two wildcards and one lowercase char right -> valid' do
132
+ # /valid/validFieldTag.json
133
+ expect(parser.field_tag).to parse('..c', trace: true, reporter: reporter)
134
+ end
135
+
136
+ it 'two wildcards left one uppercase char -> valid' do
137
+ # /valid/validFieldTag.json
138
+ expect(parser.field_tag).to parse('..C', trace: true, reporter: reporter)
139
+ end
140
+
141
+ it 'two wildcards left with digit -> valid' do
142
+ # /valid/validFieldTag.json
143
+ expect(parser.field_tag).to parse('..0', trace: true, reporter: reporter)
144
+ end
145
+
146
+ it 'wildcard between digits -> valid' do
147
+ # /valid/validFieldTag.json
148
+ expect(parser.field_tag).to parse('1.0', trace: true, reporter: reporter)
149
+ end
150
+
151
+ end
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end