metanorma-standoc 2.2.3.1 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +2 -1
  3. data/lib/metanorma/standoc/biblio.rng +32 -1
  4. data/lib/metanorma/standoc/cleanup_biblio.rb +111 -23
  5. data/lib/metanorma/standoc/cleanup_boilerplate.rb +2 -2
  6. data/lib/metanorma/standoc/front.rb +1 -0
  7. data/lib/metanorma/standoc/render.rb +1 -0
  8. data/lib/metanorma/standoc/term_lookup_cleanup.rb +32 -13
  9. data/lib/metanorma/standoc/utils.rb +3 -3
  10. data/lib/metanorma/standoc/validate.rb +12 -3
  11. data/lib/metanorma/standoc/version.rb +1 -1
  12. data/metanorma-standoc.gemspec +2 -2
  13. data/spec/metanorma/base_spec.rb +10 -1
  14. data/spec/metanorma/biblio_spec.rb +47 -17
  15. data/spec/metanorma/cleanup_sections_spec.rb +2 -1
  16. data/spec/metanorma/macros_concept_spec.rb +1 -1
  17. data/spec/metanorma/validate_spec.rb +33 -0
  18. data/spec/vcr_cassettes/bsi16341.yml +38 -38
  19. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +64 -64
  20. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  21. data/spec/vcr_cassettes/hide_refs.yml +53 -53
  22. data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
  23. data/spec/vcr_cassettes/isobib_get_123_1.yml +22 -22
  24. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +54 -54
  25. data/spec/vcr_cassettes/isobib_get_123_2.yml +24 -24
  26. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  27. data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
  28. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +22 -24
  29. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +55 -55
  30. data/spec/vcr_cassettes/std-link.yml +13 -13
  31. metadata +6 -10
  32. data/spec/requirements/default/blocks_spec.rb +0 -250
  33. data/spec/requirements/default/cleanup_spec.rb +0 -173
  34. data/spec/requirements/modspec/cleanup_spec.rb +0 -333
  35. data/spec/requirements/modspec/validate_spec.rb +0 -330
@@ -1,333 +0,0 @@
1
- require "spec_helper"
2
- require "fileutils"
3
-
4
- RSpec.describe Metanorma::Requirements::Modspec do
5
- it "extends requirement dl syntax" do
6
- input = <<~INPUT
7
- #{ASCIIDOC_BLANK_HDR}
8
-
9
- [requirement,model=ogc]
10
- ====
11
- [%metadata]
12
- type:: class
13
- identifier:: \\http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules
14
- subject:: Encoding of logical models
15
- inherit:: urn:iso:dis:iso:19156:clause:7.2.2
16
- inherit:: urn:iso:dis:iso:19156:clause:8
17
- inherit:: http://www.opengis.net/doc/IS/GML/3.2/clause/2.4
18
- inherit:: O&M Abstract model, OGC 10-004r3, clause D.3.4
19
- inherit:: http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used
20
- inherit:: <<ref2>>
21
- inherit:: <<ref3>>
22
- classification:: priority:P0
23
- classification:: domain:Hydrology,Groundwater
24
- classification:: control-class:Technical
25
- obligation:: recommendation,requirement
26
- conditions::
27
- . Candidate test subject is a witch
28
- . Widget has been suitably calibrated for aerodynamics
29
- part:: Determine travel distance by flight path
30
- description:: Interpolated description
31
- recommendation:: /label/1
32
- part:: Widget has been suitably calibrated for aerodynamics
33
- test-method:: Method
34
- description::: Method description
35
- step::: Step 1
36
- step:::: Step 2
37
- test-purpose:: Purpose
38
- test-method-type:: Method Type
39
- reference:: <<ref2>>
40
- step:: Step
41
- Test Method:: Method2
42
- Test Purpose:: Purpose2
43
- Test Method Type:: Method Type2
44
- target:: http://www.example.com
45
- indirect-dependency:: http://www.example.com
46
- indirect-dependency:: <<ref3>>
47
-
48
- Logical models encoded as XSDs should be faithful to the original UML conceptual
49
- models.
50
- ====
51
- INPUT
52
- output = <<~OUTPUT
53
- #{BLANK_HDR}
54
- <sections>
55
- <requirement id='_' obligation='recommendation,requirement' model='ogc' type='class'>
56
- <identifier>http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules</identifier>
57
- <subject>Encoding of logical models</subject>
58
- <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
59
- <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
60
- <inherit>http://www.opengis.net/doc/IS/GML/3.2/clause/2.4</inherit>
61
- <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
62
- <inherit>http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used</inherit>
63
- <inherit>
64
- <xref target='ref2'/>
65
- </inherit>
66
- <inherit>
67
- <xref target='ref3'/>
68
- </inherit>
69
- <classification>
70
- <tag>priority</tag>
71
- <value>P0</value>
72
- </classification>
73
- <classification>
74
- <tag>domain</tag>
75
- <value>Hydrology</value>
76
- </classification>
77
- <classification>
78
- <tag>domain</tag>
79
- <value>Groundwater</value>
80
- </classification>
81
- <classification>
82
- <tag>control-class</tag>
83
- <value>Technical</value>
84
- </classification>
85
- <classification>
86
- <tag>Test Method</tag>
87
- <value>Method2</value>
88
- </classification>
89
- <classification>
90
- <tag>Test Purpose</tag>
91
- <value>Purpose2</value>
92
- </classification>
93
- <classification>
94
- <tag>Test Method Type</tag>
95
- <value>Method Type2</value>
96
- </classification>
97
- <classification>
98
- <tag>target</tag>
99
- <value>http://www.example.com</value>
100
- </classification>
101
- <classification>
102
- <tag>indirect-dependency</tag>
103
- <value>
104
- <link target='http://www.example.com'/>
105
- </value>
106
- </classification>
107
- <classification>
108
- <tag>indirect-dependency</tag>
109
- <value>
110
- <xref target='ref3'/>
111
- </value>
112
- </classification>
113
- <component class='conditions'>
114
- <ol id='_' type='arabic'>
115
- <li>
116
- <p id='_'>Candidate test subject is a witch</p>
117
- </li>
118
- <li>
119
- <p id='_'>Widget has been suitably calibrated for aerodynamics</p>
120
- </li>
121
- </ol>
122
- </component>
123
- <component class='part'>
124
- <p id='_'>Determine travel distance by flight path</p>
125
- </component>
126
- <description>
127
- <p id='_'>Interpolated description</p>
128
- </description>
129
- <recommendation id='_' model="ogc" type=""><identifier>/label/1</identifier></recommendation>
130
- <component class='part'>
131
- <p id='_'>Widget has been suitably calibrated for aerodynamics</p>
132
- </component>
133
- <component class='test-method'>
134
- <p id='_'>Method</p>
135
- <description>
136
- <p id='_'>Method description</p>
137
- </description>
138
- <component class='step'>
139
- <p id='_'>Step 1</p>
140
- <component class='step'>
141
- <p id='_'>Step 2</p>
142
- </component>
143
- </component>
144
- </component>
145
- <component class='test-purpose'>
146
- <p id='_'>Purpose</p>
147
- </component>
148
- <component class='test-method-type'>
149
- <p id='_'>Method Type</p>
150
- </component>
151
- <component class='reference'>
152
- <p id='_'>
153
- <xref target='ref2'/>
154
- </p>
155
- </component>
156
- <component class='step'>
157
- <p id='_'>Step</p>
158
- </component>
159
- <component class='test-method'>
160
- <p id='_'>Method2</p>
161
- </component>
162
- <component class='test-purpose'>
163
- <p id='_'>Purpose2</p>
164
- </component>
165
- <component class='test-method-type'>
166
- <p id='_'>Method Type2</p>
167
- </component>
168
- <description>
169
- <p id='_'>
170
- Logical models encoded as XSDs should be faithful to the original UML
171
- conceptual models.
172
- </p>
173
- </description>
174
- </requirement>
175
- </sections>
176
- </standard-document>
177
- OUTPUT
178
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
179
- .to be_equivalent_to xmlpp(output)
180
- end
181
-
182
- it "allows nested steps in requirement test methods" do
183
- input = <<~INPUT
184
- #{ASCIIDOC_BLANK_HDR}
185
-
186
- [requirement,model=ogc]
187
- ====
188
- [.component,class=Test method type]
189
- --
190
- Manual Inspection
191
- --
192
-
193
- [.component,class=Test method]
194
- =====
195
-
196
- [.component,class=step]
197
- ======
198
- For each UML class defined or referenced in the Tunnel Package:
199
-
200
- [.component,class=step]
201
- --
202
- Validate that the Implementation Specification contains a data element which represents the same concept as that defined for the UML class.
203
- --
204
-
205
- [.component,class=step]
206
- --
207
- Validate that the data element has the same relationships with other elements as those defined for the UML class. Validate that those relationships have the same source, target, direction, roles, and multiplicies as those documented in the Conceptual Model.
208
- --
209
- ======
210
- =====
211
- ====
212
- INPUT
213
- output = <<~OUTPUT
214
- #{BLANK_HDR}
215
- <sections>
216
- <requirement id='_' model='ogc' type="">
217
- <component exclude='false' class='Test method type'>
218
- <p id='_'>Manual Inspection</p>
219
- </component>
220
- <component exclude='false' class='Test method'>
221
- <component exclude='false' class='step'>
222
- <p id='_'>For each UML class defined or referenced in the Tunnel Package:</p>
223
- <component exclude='false' class='step'>
224
- <p id='_'>
225
- Validate that the Implementation Specification contains a data
226
- element which represents the same concept as that defined for
227
- the UML class.
228
- </p>
229
- </component>
230
- <component exclude='false' class='step'>
231
- <p id='_'>
232
- Validate that the data element has the same relationships with
233
- other elements as those defined for the UML class. Validate that
234
- those relationships have the same source, target, direction,
235
- roles, and multiplicies as those documented in the Conceptual
236
- Model.
237
- </p>
238
- </component>
239
- </component>
240
- </component>
241
- </requirement>
242
- </sections>
243
- </standard-document>
244
- OUTPUT
245
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
246
- .to be_equivalent_to xmlpp(output)
247
- end
248
-
249
- it "uses ModSpec requirement types" do
250
- input = <<~INPUT
251
- #{ASCIIDOC_BLANK_HDR}
252
-
253
- [.requirement,type=requirement,model=ogc]
254
- ====
255
- ====
256
-
257
- [.requirement,type=recommendation,model=ogc]
258
- ====
259
- ====
260
-
261
- [.requirement,type=permission,model=ogc]
262
- ====
263
- ====
264
-
265
- [.requirement,type=requirements_class,model=ogc]
266
- ====
267
- ====
268
-
269
- [.requirement,type=conformance_test,model=ogc]
270
- ====
271
- ====
272
-
273
- [.requirement,type=conformance_class,model=ogc]
274
- ====
275
- ====
276
-
277
- [.requirement,type=abstract_test,model=ogc]
278
- ====
279
- ====
280
-
281
- INPUT
282
- output = <<~OUTPUT
283
- #{BLANK_HDR}
284
- <sections>
285
- <requirement id='_' type='general' model="ogc"> </requirement>
286
- <requirement id='_' type='general' model="ogc"> </requirement>
287
- <requirement id='_' type='general' model="ogc"> </requirement>
288
- <requirement id='_' type='class' model="ogc"> </requirement>
289
- <requirement id='_' type='verification' model="ogc"> </requirement>
290
- <requirement id='_' type='conformanceclass' model="ogc"> </requirement>
291
- <requirement id='_' type='abstracttest' model="ogc"> </requirement>
292
- </sections>
293
- </standard-document>
294
- OUTPUT
295
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
296
- .to be_equivalent_to xmlpp(output)
297
- end
298
-
299
- it "uses ModSpec requirement style attributes" do
300
- input = <<~INPUT
301
- #{ASCIIDOC_BLANK_HDR}
302
-
303
- [requirements_class,model=ogc]
304
- ====
305
- ====
306
-
307
- [conformance_test,model=ogc]
308
- ====
309
- ====
310
-
311
- [conformance_class,model=ogc]
312
- ====
313
- ====
314
-
315
- [abstract_test,model=ogc]
316
- ====
317
- ====
318
-
319
- INPUT
320
- output = <<~OUTPUT
321
- #{BLANK_HDR}
322
- <sections>
323
- <requirement id='_' type='class' model="ogc"> </requirement>
324
- <requirement id='_' type='verification' model="ogc"> </requirement>
325
- <requirement id='_' type='conformanceclass' model="ogc"> </requirement>
326
- <requirement id='_' type='abstracttest' model="ogc"> </requirement>
327
- </sections>
328
- </standard-document>
329
- OUTPUT
330
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
331
- .to be_equivalent_to xmlpp(output)
332
- end
333
- end
@@ -1,330 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::Requirements::Modspec do
4
- it "does not warn if no linkage issues" do
5
- FileUtils.rm_f "test.err"
6
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
7
- = Document title
8
- Author
9
- :docfile: test.adoc
10
- :nodoc:
11
- :requirements-model: ogc
12
-
13
- [[A1]]
14
- [.requirement,type=requirement]
15
- ====
16
- [%metadata]
17
- identifier:: A
18
- ====
19
-
20
- [[B1]]
21
- [.requirement,type=recommendation]
22
- ====
23
- [%metadata]
24
- identifier:: B
25
- ====
26
-
27
- [[C1]]
28
- [.requirement,type=permission]
29
- ====
30
- [%metadata]
31
- identifier:: C
32
- ====
33
-
34
- [[D1]]
35
- [.requirement,type=conformance_test]
36
- ====
37
- [%metadata]
38
- identifier:: D
39
- classification:: target:A
40
- ====
41
-
42
- [[E1]]
43
- [.recommendation,type=conformance_test]
44
- ====
45
- [%metadata]
46
- identifier:: E
47
- classification:: target:B
48
- ====
49
-
50
- [[F1]]
51
- [.permission,type=conformance_test]
52
- ====
53
- [%metadata]
54
- identifier:: F
55
- target:: C
56
- ====
57
-
58
- [[G1]]
59
- [.requirement,type=requirements_class]
60
- ====
61
- [%metadata]
62
- identifier:: G
63
- requirement:: A
64
- ====
65
-
66
- [[H1]]
67
- [.recommendation,type=requirements_class]
68
- ====
69
- [%metadata]
70
- identifier:: H
71
- requirement:: A
72
- ====
73
-
74
- [[I1]]
75
- [.permission,type=requirements_class]
76
- ====
77
- [%metadata]
78
- identifier:: I
79
- requirement:: A
80
- ====
81
-
82
- [[J1]]
83
- [.requirement,type=conformance_class]
84
- ====
85
- [%metadata]
86
- classification:: target:G
87
- requirement:: D
88
- ====
89
-
90
- [[K1]]
91
- [.recommendation,type=conformance_class]
92
- ====
93
- [%metadata]
94
- classification:: target:H
95
- requirement:: E
96
- ====
97
-
98
- [[L1]]
99
- [.permission,type=conformance_class]
100
- ====
101
- [%metadata]
102
- classification:: target:I
103
- requirement:: F
104
- ====
105
-
106
- INPUT
107
- expect(File.read("test.err"))
108
- .not_to include "no corresponding Requirement"
109
- expect(File.read("test.err"))
110
- .not_to include "has no corresponding Conformance test"
111
- expect(File.read("test.err"))
112
- .not_to include "has no corresponding Requirement class"
113
- expect(File.read("test.err"))
114
- .not_to include "has no corresponding Conformance class"
115
- end
116
-
117
- it "warns of disconnect between requirements and conformance tests, #1" do
118
- FileUtils.rm_f "test.err"
119
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
120
- = Document title
121
- Author
122
- :docfile: test.adoc
123
- :nodoc:
124
- :requirements-model: ogc
125
-
126
- [[A]]
127
- [.requirement,type=requirement]
128
- ====
129
- ====
130
-
131
- [[B]]
132
- [.requirement,type=recommendation]
133
- ====
134
- ====
135
-
136
- [[C]]
137
- [.requirement,type=permission]
138
- ====
139
- ====
140
-
141
- [[D]]
142
- [.requirement,type=conformance_test]
143
- ====
144
- ====
145
-
146
- [[E]]
147
- [.recommendation,type=conformance_test]
148
- ====
149
- ====
150
-
151
- [[F1]]
152
- [.permission,type=conformance_test]
153
- ====
154
- [%metadata]
155
- identifier:: F
156
- ====
157
-
158
- [[G1]]
159
- [.requirement,type=requirements_class]
160
- ====
161
- [%metadata]
162
- identifier:: G
163
- ====
164
-
165
- [[H1]]
166
- [.recommendation,type=requirements_class]
167
- ====
168
- [%metadata]
169
- identifier:: H
170
- ====
171
-
172
- [[I1]]
173
- [.permission,type=requirements_class]
174
- ====
175
- [%metadata]
176
- identifier:: I
177
- ====
178
-
179
- [[J1]]
180
- [.requirement,type=conformance_class]
181
- ====
182
- [%metadata]
183
- identifier:: J
184
- ====
185
-
186
- [[K1]]
187
- [.recommendation,type=conformance_class]
188
- ====
189
- [%metadata]
190
- identifier:: K
191
- ====
192
-
193
- [[L1]]
194
- [.permission,type=conformance_class]
195
- ====
196
- [%metadata]
197
- identifier:: L
198
- ====
199
-
200
- INPUT
201
-
202
- expect(File.read("test.err"))
203
- .to include "Conformance test D has no corresponding Requirement"
204
- expect(File.read("test.err"))
205
- .to include "Requirement A has no corresponding Conformance test"
206
- expect(File.read("test.err"))
207
- .to include "Conformance class J has no corresponding Requirement class"
208
- expect(File.read("test.err"))
209
- .to include "Requirement class G has no corresponding Conformance class"
210
- end
211
-
212
- it "warns of disconnect between requirements and conformance tests, #2" do
213
- FileUtils.rm_f "test.err"
214
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
215
- = Document title
216
- Author
217
- :docfile: test.adoc
218
- :nodoc:
219
- :requirements-model: ogc
220
-
221
- [[A1]]
222
- [.requirement]
223
- ====
224
- [%metadata]
225
- identifier:: A
226
- ====
227
-
228
- [[B1]]
229
- [.requirement,type=recommendation]
230
- ====
231
- ====
232
-
233
- [[C1]]
234
- [.requirement,type=permission]
235
- ====
236
- ====
237
-
238
- [[D1]]
239
- [.requirement,type=conformance_test]
240
- ====
241
- [%metadata]
242
- identifier:: D
243
- target:: A
244
- ====
245
- INPUT
246
-
247
- expect(File.read("test.err"))
248
- .not_to include "Conformance test D has no corresponding Requirement"
249
- end
250
-
251
- it "warns of disconnect between requirement classes and requirements" do
252
- FileUtils.rm_f "test.err"
253
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
254
- = Document title
255
- Author
256
- :docfile: test.adoc
257
- :nodoc:
258
- :requirements-model: ogc
259
-
260
- [[A]]
261
- [.requirement,type=requirement]
262
- ====
263
- ====
264
-
265
- [[B]]
266
- [.requirement,type=recommendation]
267
- ====
268
- ====
269
-
270
- [[C]]
271
- [.requirement,type=permission]
272
- ====
273
- ====
274
-
275
- [[G1]]
276
- [.requirement,type=requirements_class]
277
- ====
278
- [%metadata]
279
- identifier:: G
280
- ====
281
-
282
- [[H1]]
283
- [.recommendation,type=requirements_class]
284
- ====
285
- [%metadata]
286
- identifier:: H
287
- ====
288
-
289
- [[I1]]
290
- [.permission,type=requirements_class]
291
- ====
292
- [%metadata]
293
- identifier:: I
294
- ====
295
- INPUT
296
- expect(File.read("test.err"))
297
- .to include "Requirement class G has no corresponding Requirement"
298
- expect(File.read("test.err"))
299
- .to include "Requirement class H has no corresponding Requirement"
300
- expect(File.read("test.err"))
301
- .to include "Requirement class I has no corresponding Requirement"
302
- end
303
-
304
-
305
- it "warns of disconnect between conformance classes and conformance tests" do
306
- FileUtils.rm_f "test.err"
307
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
308
- = Document title
309
- Author
310
- :docfile: test.adoc
311
- :nodoc:
312
- :requirements-model: ogc
313
-
314
- [[A]]
315
- [.requirement,type=conformance_test]
316
- ====
317
- ====
318
-
319
- [[B]]
320
- [.requirement,type=conformance_class]
321
- ====
322
- ====
323
-
324
- INPUT
325
- expect(File.read("test.err"))
326
- .to include "Conformance class B has no corresponding Conformance test"
327
- expect(File.read("test.err"))
328
- .to include "Conformance test A has no corresponding Conformance class"
329
- end
330
- end