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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e305c214cf30723ae670f46f1bf3ffbe4d00b1867581e1db5be79f2ab8155a35
4
- data.tar.gz: b00c8a4e447f269176696da0b743d184e594ffd5a8fb0a0b83787343917a4846
3
+ metadata.gz: 6b95f1ad54d625a1441f1ca0220e944559232bf9f477b56e9a14c32469622928
4
+ data.tar.gz: 060d870d464c07cc9ae12702136d66292e39006af3c617c7bb8f42b4c7e1dc5c
5
5
  SHA512:
6
- metadata.gz: 847be19dfe955889f38c8e07c23c5fe297d84aec7d0cd3b81a2a6d2188ab3f8cfc5c6d4330a17969b14068baa73524b85a37fe469136b720c6d2f7bd71e99be0
7
- data.tar.gz: 4645b59b7d0ed3b7497b5e38dc9a29c7fcb32c54a622bdc7cba22dede1be05719b818c991727aae4ff229ec2e46ab58834c74b5b449eea4ed4f30bf48cdab957
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
- \\s*
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
@@ -5,7 +5,7 @@ module Defmastership
5
5
  # Common to defmastership and asciidoctor-defmastership
6
6
  module Core
7
7
  # [String] Gem version
8
- VERSION = '1.5.1'
8
+ VERSION = '1.5.2'
9
9
  public_constant :VERSION
10
10
  end
11
11
  end
data/spec/spec_helper.rb CHANGED
@@ -13,9 +13,8 @@ SimpleCov.start do
13
13
  add_filter 'vendor'
14
14
  add_filter 'set_join_hack'
15
15
 
16
- minimum_coverage 100
17
-
18
16
  enable_coverage :branch
17
+ minimum_coverage line: 100, branch: 100
19
18
  end
20
19
 
21
20
  RSpec::Matchers.define(:matchdata_including) do |h|
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defmastership-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérôme Arbez-Gindre