defmastership-core 1.5.1 → 1.5.2
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 +4 -4
- data/.gitlab-ci.yml +0 -10
- data/lib/defmastership/core/constants.rb +6 -5
- data/lib/defmastership/core/version.rb +1 -1
- data/spec/spec_helper.rb +1 -2
- data/spec/unit/defmastership/core/dm_regexp_spec.rb +43 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b95f1ad54d625a1441f1ca0220e944559232bf9f477b56e9a14c32469622928
|
4
|
+
data.tar.gz: 060d870d464c07cc9ae12702136d66292e39006af3c617c7bb8f42b4c7e1dc5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84bfd7c8d7b5ce2e15640fd450e0b8375d73608fc8b09e0b0e7cd989d1f4f10eb4d2d20cdefe9d93b1822cd3b71fc1fe63f123e489d65e3d4e281a1dc2bfeecf
|
7
|
+
data.tar.gz: 3fadd0ba25f82931f55198c2c0d9c1821e156352e0597ce3e3ca19857bc1ca61bbca7e119f95ea4b95574a485b7b1b455c8f7227731aada5816e068f8152423b
|
data/.gitlab-ci.yml
CHANGED
@@ -28,16 +28,6 @@ yard documentation:
|
|
28
28
|
paths:
|
29
29
|
- doc
|
30
30
|
|
31
|
-
unit tests ruby3.0:
|
32
|
-
image: ruby:3.0
|
33
|
-
script:
|
34
|
-
- bundle exec rake test:spec
|
35
|
-
|
36
|
-
unit tests ruby3.1:
|
37
|
-
image: ruby:3.1
|
38
|
-
script:
|
39
|
-
- bundle exec rake test:spec
|
40
|
-
|
41
31
|
unit tests ruby3.2:
|
42
32
|
image: ruby:3.2
|
43
33
|
script:
|
@@ -48,6 +48,10 @@ module Defmastership
|
|
48
48
|
REFERENCE = an_id('reference').freeze
|
49
49
|
public_constant :REFERENCE
|
50
50
|
|
51
|
+
# [Regexp] match reference with optional version and checksum
|
52
|
+
REF_WITH_OPT_VER_CHK = "\\s*#{REFERENCE}#{DEF_VERSION_AND_CHECKSUM}\\s*".freeze
|
53
|
+
public_constant :REF_WITH_OPT_VER_CHK
|
54
|
+
|
51
55
|
# [Regexp] match defintion summary
|
52
56
|
DEF_SUMMARY = <<~'SUM'
|
53
57
|
\s*
|
@@ -79,10 +83,7 @@ module Defmastership
|
|
79
83
|
#{DEF_KEYWORD}
|
80
84
|
#{DEF_TYPE}
|
81
85
|
,
|
82
|
-
|
83
|
-
#{REFERENCE}
|
84
|
-
#{DEF_VERSION_AND_CHECKSUM}
|
85
|
-
\\s*
|
86
|
+
#{REF_WITH_OPT_VER_CHK}
|
86
87
|
#{DEF_SUMMARY}
|
87
88
|
#{DEF_LABELS}
|
88
89
|
\\s*
|
@@ -124,7 +125,7 @@ module Defmastership
|
|
124
125
|
public_constant :IREF_DEF_AFT
|
125
126
|
# [Regexp] match an internal cross reference
|
126
127
|
IREF_DEF = Regexp.new(
|
127
|
-
"#{IREF_DEF_BEF}#{an_id('intref')}#{IREF_DEF_AFT}",
|
128
|
+
"#{IREF_DEF_BEF}#{an_id('intref')}#{DEF_VERSION_AND_CHECKSUM}#{IREF_DEF_AFT}",
|
128
129
|
Regexp::EXTENDED
|
129
130
|
)
|
130
131
|
public_constant :IREF_DEF
|
data/spec/spec_helper.rb
CHANGED
@@ -217,6 +217,39 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
|
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
|
+
describe 'REF_WITH_OPT_VER_CHK' do
|
221
|
+
subject(:regexp) { Regexp.new("^#{described_class::REF_WITH_OPT_VER_CHK}$", Regexp::EXTENDED) }
|
222
|
+
|
223
|
+
[
|
224
|
+
'abc',
|
225
|
+
'_abc_efg_',
|
226
|
+
'-abc-efg-',
|
227
|
+
'REFERENCE-0001',
|
228
|
+
'REFERENCE-0001(a)',
|
229
|
+
'REFERENCE-0001(~1234abcd)',
|
230
|
+
'REFERENCE-0001(a~1234abcd)'
|
231
|
+
].each do |line|
|
232
|
+
it { is_expected.to(match(line)) }
|
233
|
+
end
|
234
|
+
|
235
|
+
it { expect(regexp.match('the_ref')[:reference]).to(eq('the_ref')) }
|
236
|
+
it { expect(regexp.match('the_ref')[:version_and_checksum]).to(be_nil) }
|
237
|
+
it { expect(regexp.match('the_ref')[:explicit_version]).to(be_nil) }
|
238
|
+
it { expect(regexp.match('the_ref')[:explicit_checksum]).to(be_nil) }
|
239
|
+
it { expect(regexp.match('the_ref(a)')[:reference]).to(eq('the_ref')) }
|
240
|
+
it { expect(regexp.match('the_ref(a)')[:version_and_checksum]).to(eq('(a)')) }
|
241
|
+
it { expect(regexp.match('the_ref(a)')[:explicit_version]).to(eq('a')) }
|
242
|
+
it { expect(regexp.match('the_ref(a)')[:explicit_checksum]).to(be_nil) }
|
243
|
+
it { expect(regexp.match('the_ref(~abcd)')[:reference]).to(eq('the_ref')) }
|
244
|
+
it { expect(regexp.match('the_ref(~abcd)')[:version_and_checksum]).to(eq('(~abcd)')) }
|
245
|
+
it { expect(regexp.match('the_ref(~abcd)')[:explicit_version]).to(be_nil) }
|
246
|
+
it { expect(regexp.match('the_ref(~abcd)')[:explicit_checksum]).to(eq('~abcd')) }
|
247
|
+
it { expect(regexp.match('the_ref(z~abcd)')[:reference]).to(eq('the_ref')) }
|
248
|
+
it { expect(regexp.match('the_ref(z~abcd)')[:version_and_checksum]).to(eq('(z~abcd)')) }
|
249
|
+
it { expect(regexp.match('the_ref(z~abcd)')[:explicit_version]).to(eq('z')) }
|
250
|
+
it { expect(regexp.match('the_ref(z~abcd)')[:explicit_checksum]).to(eq('~abcd')) }
|
251
|
+
end
|
252
|
+
|
220
253
|
describe 'DEF_SUMMARY' do
|
221
254
|
subject(:regexp) { Regexp.new("^#{described_class::DEF_SUMMARY}$", Regexp::EXTENDED) }
|
222
255
|
|
@@ -420,7 +453,7 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
|
|
420
453
|
describe 'EREF_DEF' do
|
421
454
|
subject(:regexp) { described_class::EREF_DEF }
|
422
455
|
|
423
|
-
let(:one_match) { regexp.match('defs:eref[abcdef, [ABC, EDF(a~1234abcd)]]') }
|
456
|
+
let(:one_match) { regexp.match('defs:eref[abcdef, [ABC, EDF(a~1234abcd) ]]') }
|
424
457
|
|
425
458
|
context 'with valid external ref' do
|
426
459
|
[
|
@@ -507,8 +540,17 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
|
|
507
540
|
it { is_expected.to(match(' defs:iref[ bla_bla]')) }
|
508
541
|
it { is_expected.to(match(' defs:iref[ bla_bla ]')) }
|
509
542
|
it { is_expected.to(match(' defs:iref[ bla_bla ] ')) }
|
543
|
+
it { is_expected.to(match(' defs:iref[ bla_bla(c~abcd1234) ] ')) }
|
510
544
|
|
511
545
|
it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:intref]).to(eq('bla_bla')) }
|
546
|
+
it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:version_and_checksum]).to(be_nil) }
|
547
|
+
it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:explicit_version]).to(be_nil) }
|
548
|
+
it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:explicit_checksum]).to(be_nil) }
|
549
|
+
|
550
|
+
it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:intref]).to(eq('bla')) }
|
551
|
+
it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:version_and_checksum]).to(eq('(c~abcd1234)')) }
|
552
|
+
it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:explicit_version]).to(eq('c')) }
|
553
|
+
it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:explicit_checksum]).to(eq('~abcd1234')) }
|
512
554
|
end
|
513
555
|
|
514
556
|
context 'with invalid IREF_DEF' do
|