ruby-marc-spec 0.1.0
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 +7 -0
- data/.github/workflows/build.yml +18 -0
- data/.gitignore +388 -0
- data/.gitmodules +3 -0
- data/.idea/codeStyles/codeStyleConfig.xml +5 -0
- data/.idea/go.imports.xml +6 -0
- data/.idea/inspectionProfiles/Project_Default.xml +23 -0
- data/.idea/marc_spec.iml +102 -0
- data/.idea/misc.xml +6 -0
- data/.idea/modules.xml +8 -0
- data/.idea/templateLanguages.xml +6 -0
- data/.idea/vcs.xml +7 -0
- data/.rubocop.yml +269 -0
- data/.ruby-version +1 -0
- data/.simplecov +8 -0
- data/CHANGES.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE.md +21 -0
- data/README.md +172 -0
- data/Rakefile +20 -0
- data/lib/.rubocop.yml +5 -0
- data/lib/marc/spec/module_info.rb +14 -0
- data/lib/marc/spec/parsing/closed_int_range.rb +28 -0
- data/lib/marc/spec/parsing/closed_lc_alpha_range.rb +28 -0
- data/lib/marc/spec/parsing/parser.rb +213 -0
- data/lib/marc/spec/parsing.rb +1 -0
- data/lib/marc/spec/queries/al_num_range.rb +105 -0
- data/lib/marc/spec/queries/applicable.rb +18 -0
- data/lib/marc/spec/queries/character_spec.rb +81 -0
- data/lib/marc/spec/queries/comparison_string.rb +45 -0
- data/lib/marc/spec/queries/condition.rb +133 -0
- data/lib/marc/spec/queries/condition_context.rb +49 -0
- data/lib/marc/spec/queries/dsl.rb +80 -0
- data/lib/marc/spec/queries/indicator_value.rb +77 -0
- data/lib/marc/spec/queries/operator.rb +129 -0
- data/lib/marc/spec/queries/part.rb +63 -0
- data/lib/marc/spec/queries/position.rb +59 -0
- data/lib/marc/spec/queries/position_or_range.rb +27 -0
- data/lib/marc/spec/queries/query.rb +94 -0
- data/lib/marc/spec/queries/query_executor.rb +52 -0
- data/lib/marc/spec/queries/selector.rb +12 -0
- data/lib/marc/spec/queries/subfield.rb +88 -0
- data/lib/marc/spec/queries/subfield_value.rb +63 -0
- data/lib/marc/spec/queries/tag.rb +107 -0
- data/lib/marc/spec/queries/transform.rb +154 -0
- data/lib/marc/spec/queries.rb +1 -0
- data/lib/marc/spec.rb +32 -0
- data/rakelib/.rubocop.yml +19 -0
- data/rakelib/bundle.rake +8 -0
- data/rakelib/coverage.rake +11 -0
- data/rakelib/gem.rake +54 -0
- data/rakelib/parser_specs/formatter.rb +31 -0
- data/rakelib/parser_specs/parser_specs.rb.txt.erb +35 -0
- data/rakelib/parser_specs/rule.rb +95 -0
- data/rakelib/parser_specs/suite.rb +91 -0
- data/rakelib/parser_specs/test.rb +97 -0
- data/rakelib/parser_specs.rb +1 -0
- data/rakelib/rubocop.rake +18 -0
- data/rakelib/spec.rake +27 -0
- data/ruby-marc-spec.gemspec +42 -0
- data/spec/.rubocop.yml +46 -0
- data/spec/README.md +16 -0
- data/spec/data/b23161018-sru.xml +182 -0
- data/spec/data/sandburg.xml +82 -0
- data/spec/generated/char_indicator_spec.rb +174 -0
- data/spec/generated/char_spec.rb +113 -0
- data/spec/generated/comparison_string_spec.rb +74 -0
- data/spec/generated/field_tag_spec.rb +156 -0
- data/spec/generated/index_char_spec.rb +669 -0
- data/spec/generated/index_indicator_spec.rb +174 -0
- data/spec/generated/index_spec.rb +113 -0
- data/spec/generated/index_sub_spec_spec.rb +1087 -0
- data/spec/generated/indicators_spec.rb +75 -0
- data/spec/generated/position_or_range_spec.rb +110 -0
- data/spec/generated/sub_spec_spec.rb +208 -0
- data/spec/generated/sub_spec_sub_spec_spec.rb +1829 -0
- data/spec/generated/subfield_char_spec.rb +405 -0
- data/spec/generated/subfield_range_range_spec.rb +48 -0
- data/spec/generated/subfield_range_spec.rb +87 -0
- data/spec/generated/subfield_range_sub_spec_spec.rb +214 -0
- data/spec/generated/subfield_tag_range_spec.rb +477 -0
- data/spec/generated/subfield_tag_sub_spec_spec.rb +3216 -0
- data/spec/generated/subfield_tag_tag_spec.rb +5592 -0
- data/spec/marc/spec/parsing/closed_int_range_spec.rb +49 -0
- data/spec/marc/spec/parsing/closed_lc_alpha_range_spec.rb +49 -0
- data/spec/marc/spec/parsing/parser_spec.rb +545 -0
- data/spec/marc/spec/queries/al_num_range_spec.rb +114 -0
- data/spec/marc/spec/queries/character_spec_spec.rb +28 -0
- data/spec/marc/spec/queries/comparison_string_spec.rb +28 -0
- data/spec/marc/spec/queries/indicator_value_spec.rb +28 -0
- data/spec/marc/spec/queries/query_spec.rb +200 -0
- data/spec/marc/spec/queries/subfield_spec.rb +92 -0
- data/spec/marc/spec/queries/subfield_value_spec.rb +31 -0
- data/spec/marc/spec/queries/tag_spec.rb +144 -0
- data/spec/marc/spec/queries/transform_spec.rb +459 -0
- data/spec/marc_spec_spec.rb +247 -0
- data/spec/scratch_spec.rb +112 -0
- data/spec/spec_helper.rb +23 -0
- metadata +341 -0
@@ -0,0 +1,214 @@
|
|
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 :subfield_range_sub_spec do
|
9
|
+
let(:parser) { Parser.new }
|
10
|
+
let(:reporter) { Parslet::ErrorReporter::Deepest.new }
|
11
|
+
|
12
|
+
describe 'marc_spec: valid field tag, subfield range and subspec' do
|
13
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
14
|
+
|
15
|
+
describe 'subfield range with lowercase subfieldtags' do
|
16
|
+
|
17
|
+
it '&& all digits -> valid' do
|
18
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
19
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\Poe}', trace: true, reporter: reporter)
|
20
|
+
end
|
21
|
+
|
22
|
+
it '&& all lowercase chars -> valid' do
|
23
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
24
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\{}', trace: true, reporter: reporter)
|
25
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\~}', trace: true, reporter: reporter)
|
26
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\?}', trace: true, reporter: reporter)
|
27
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\|}', trace: true, reporter: reporter)
|
28
|
+
end
|
29
|
+
|
30
|
+
it '&& all uppercase chars special leader -> valid' do
|
31
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
32
|
+
expect(parser.marc_spec).to parse('...$a-z{$a!~\\Poe}', trace: true, reporter: reporter)
|
33
|
+
end
|
34
|
+
|
35
|
+
it '&& all wildcards -> valid' do
|
36
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
37
|
+
expect(parser.marc_spec).to parse('...$a-z{245$a}', trace: true, reporter: reporter)
|
38
|
+
end
|
39
|
+
|
40
|
+
it '&& mix one lowercase char and two digits -> valid' do
|
41
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
42
|
+
expect(parser.marc_spec).to parse('...$a-z{$a|$b|$c}', trace: true, reporter: reporter)
|
43
|
+
end
|
44
|
+
|
45
|
+
it '&& mix two lowercase chars and one digit -> valid' do
|
46
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
47
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\$}', trace: true, reporter: reporter)
|
48
|
+
end
|
49
|
+
|
50
|
+
it '&& one digit two wildcards right -> valid' do
|
51
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
52
|
+
expect(parser.marc_spec).to parse('...$a-z{$a!=$b}', trace: true, reporter: reporter)
|
53
|
+
end
|
54
|
+
|
55
|
+
it '&& one lowercase and two wildcards right -> valid' do
|
56
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
57
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\=}', trace: true, reporter: reporter)
|
58
|
+
end
|
59
|
+
|
60
|
+
it '&& one uppercase char two wildcards right -> valid' do
|
61
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
62
|
+
expect(parser.marc_spec).to parse('...$a-z{$a|$b}{$c|$d}', trace: true, reporter: reporter)
|
63
|
+
end
|
64
|
+
|
65
|
+
it '&& one wildcard between uppercase chars -> valid' do
|
66
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
67
|
+
expect(parser.marc_spec).to parse('...$a-z{$a}{$b|$c}', trace: true, reporter: reporter)
|
68
|
+
end
|
69
|
+
|
70
|
+
it '&& one wildcard left and two lowercase chars -> valid' do
|
71
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
72
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\!}', trace: true, reporter: reporter)
|
73
|
+
end
|
74
|
+
|
75
|
+
it '&& one wildcard left two uppercase chars -> valid' do
|
76
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
77
|
+
expect(parser.marc_spec).to parse('...$a-z{$a|$b}{$c}', trace: true, reporter: reporter)
|
78
|
+
end
|
79
|
+
|
80
|
+
it '&& one wildcard left with two digits -> valid' do
|
81
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
82
|
+
expect(parser.marc_spec).to parse('...$a-z{?$a}', trace: true, reporter: reporter)
|
83
|
+
end
|
84
|
+
|
85
|
+
it '&& two digits wildcard right -> valid' do
|
86
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
87
|
+
expect(parser.marc_spec).to parse('...$a-z{$a=$b}', trace: true, reporter: reporter)
|
88
|
+
end
|
89
|
+
|
90
|
+
it '&& two wildcards and one lowercase char right -> valid' do
|
91
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
92
|
+
expect(parser.marc_spec).to parse('...$a-z{$a~\\test\\}}', trace: true, reporter: reporter)
|
93
|
+
end
|
94
|
+
|
95
|
+
it '&& two wildcards left one uppercase char -> valid' do
|
96
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
97
|
+
expect(parser.marc_spec).to parse('...$a-z{/#=\\/}', trace: true, reporter: reporter)
|
98
|
+
end
|
99
|
+
|
100
|
+
it '&& two wildcards left with digit -> valid' do
|
101
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
102
|
+
expect(parser.marc_spec).to parse('...$a-z{$a}', trace: true, reporter: reporter)
|
103
|
+
end
|
104
|
+
|
105
|
+
it '&& wildcard between digits -> valid' do
|
106
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
107
|
+
expect(parser.marc_spec).to parse('...$a-z{!$a}', trace: true, reporter: reporter)
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
describe 'subfield range with digits' do
|
113
|
+
|
114
|
+
it '&& all digits -> valid' do
|
115
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
116
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\Poe}', trace: true, reporter: reporter)
|
117
|
+
end
|
118
|
+
|
119
|
+
it '&& all lowercase chars -> valid' do
|
120
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
121
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\{}', trace: true, reporter: reporter)
|
122
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\~}', trace: true, reporter: reporter)
|
123
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\?}', trace: true, reporter: reporter)
|
124
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\|}', trace: true, reporter: reporter)
|
125
|
+
end
|
126
|
+
|
127
|
+
it '&& all uppercase chars special leader -> valid' do
|
128
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
129
|
+
expect(parser.marc_spec).to parse('...$0-9{$a!~\\Poe}', trace: true, reporter: reporter)
|
130
|
+
end
|
131
|
+
|
132
|
+
it '&& all wildcards -> valid' do
|
133
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
134
|
+
expect(parser.marc_spec).to parse('...$0-9{245$a}', trace: true, reporter: reporter)
|
135
|
+
end
|
136
|
+
|
137
|
+
it '&& mix one lowercase char and two digits -> valid' do
|
138
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
139
|
+
expect(parser.marc_spec).to parse('...$0-9{$a|$b|$c}', trace: true, reporter: reporter)
|
140
|
+
end
|
141
|
+
|
142
|
+
it '&& mix two lowercase chars and one digit -> valid' do
|
143
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
144
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\$}', trace: true, reporter: reporter)
|
145
|
+
end
|
146
|
+
|
147
|
+
it '&& one digit two wildcards right -> valid' do
|
148
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
149
|
+
expect(parser.marc_spec).to parse('...$0-9{$a!=$b}', trace: true, reporter: reporter)
|
150
|
+
end
|
151
|
+
|
152
|
+
it '&& one lowercase and two wildcards right -> valid' do
|
153
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
154
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\=}', trace: true, reporter: reporter)
|
155
|
+
end
|
156
|
+
|
157
|
+
it '&& one uppercase char two wildcards right -> valid' do
|
158
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
159
|
+
expect(parser.marc_spec).to parse('...$0-9{$a|$b}{$c|$d}', trace: true, reporter: reporter)
|
160
|
+
end
|
161
|
+
|
162
|
+
it '&& one wildcard between uppercase chars -> valid' do
|
163
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
164
|
+
expect(parser.marc_spec).to parse('...$0-9{$a}{$b|$c}', trace: true, reporter: reporter)
|
165
|
+
end
|
166
|
+
|
167
|
+
it '&& one wildcard left and two lowercase chars -> valid' do
|
168
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
169
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\!}', trace: true, reporter: reporter)
|
170
|
+
end
|
171
|
+
|
172
|
+
it '&& one wildcard left two uppercase chars -> valid' do
|
173
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
174
|
+
expect(parser.marc_spec).to parse('...$0-9{$a|$b}{$c}', trace: true, reporter: reporter)
|
175
|
+
end
|
176
|
+
|
177
|
+
it '&& one wildcard left with two digits -> valid' do
|
178
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
179
|
+
expect(parser.marc_spec).to parse('...$0-9{?$a}', trace: true, reporter: reporter)
|
180
|
+
end
|
181
|
+
|
182
|
+
it '&& two digits wildcard right -> valid' do
|
183
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
184
|
+
expect(parser.marc_spec).to parse('...$0-9{$a=$b}', trace: true, reporter: reporter)
|
185
|
+
end
|
186
|
+
|
187
|
+
it '&& two wildcards and one lowercase char right -> valid' do
|
188
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
189
|
+
expect(parser.marc_spec).to parse('...$0-9{$a~\\test\\}}', trace: true, reporter: reporter)
|
190
|
+
end
|
191
|
+
|
192
|
+
it '&& two wildcards left one uppercase char -> valid' do
|
193
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
194
|
+
expect(parser.marc_spec).to parse('...$0-9{/#=\\/}', trace: true, reporter: reporter)
|
195
|
+
end
|
196
|
+
|
197
|
+
it '&& two wildcards left with digit -> valid' do
|
198
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
199
|
+
expect(parser.marc_spec).to parse('...$0-9{$a}', trace: true, reporter: reporter)
|
200
|
+
end
|
201
|
+
|
202
|
+
it '&& wildcard between digits -> valid' do
|
203
|
+
# /valid/wildCombination_validSubfieldRangeSubSpec.json
|
204
|
+
expect(parser.marc_spec).to parse('...$0-9{!$a}', trace: true, reporter: reporter)
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|