Skip to content

Commit

Permalink
Update specs for metanorma-standoc v3.0 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kwkwan committed Feb 20, 2025
1 parent f471ad2 commit a9d537d
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 91 deletions.
2 changes: 1 addition & 1 deletion metanorma-plugin-lutaml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "debug"
spec.add_development_dependency "equivalent-xml"
spec.add_development_dependency "metanorma-standoc"
spec.add_development_dependency "metanorma-standoc", "~> 3.0"
spec.add_development_dependency "rake", "~> 13"
spec.add_development_dependency "rspec", "~> 3.6"
spec.add_development_dependency "rspec-html-matchers"
Expand Down
4 changes: 2 additions & 2 deletions spec/metanorma/plugin/lutaml/lutaml_diagram_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Foo {}
<image src="_" id="_" mimetype="image/png" height="auto" width="auto"></image>
</figure>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -65,7 +65,7 @@ class Foo {}
<image src="_" id="_" mimetype="image/png" height="auto" width="auto"></image>
</figure>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down
27 changes: 15 additions & 12 deletions spec/metanorma/plugin/lutaml/lutaml_ea_xmi_preprocessor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,16 @@
end

it "correctly maps external and internal refs" do
expect(xml_convert)
.to_not(include('<xref target="My-custom-Register-section" style="short">Register</xref>'))
expect(xml_convert)
.to_not(include('<xref target="Register-section" style="short">Register</xref>'))
expect(xml_convert)
.to_not(include('<xref target="RE_ReferenceSource-section" style="short">RE_ReferenceSource</xref>'))
expect(xml_convert)
.to(include('<xref target="custom-RE_ReferenceSource" style="short">RE_ReferenceSource</xref>'))
xml_output = remove_xml_whitespaces(xml_convert)

expect(xml_output)
.to_not(include('<xref target="My-custom-Register-section" style="short"><display-text>Register</display-text></xref>'))
expect(xml_output)
.to_not(include('<xref target="Register-section" style="short"><display-text>Register</display-text></xref>'))
expect(xml_output)
.to_not(include('<xref target="RE_ReferenceSource-section" style="short"><display-text>RE_ReferenceSource</display-text></xref>'))
expect(xml_output)
.to(include('<xref target="custom-RE_ReferenceSource" style="short"><display-text>RE_ReferenceSource</display-text></xref>'))
end
end

Expand All @@ -700,10 +702,11 @@
end

it "correctly maps external and internal refs" do
expect(xml_convert)
.to(include('<xref target="My-custom-RE_Register-section" style="short">RE_Register</xref>'))
expect(xml_convert)
.to_not(include('<xref target="RE_Register-section" style="short">RE_Register</xref>'))
xml_output = remove_xml_whitespaces(xml_convert)
expect(xml_output)
.to(include('<xref target="My-custom-RE_Register-section" style="short"><display-text>RE_Register</display-text></xref>'))
expect(xml_output)
.to_not(include('<xref target="RE_Register-section" style="short"><display-text>RE_Register</display-text></xref>'))
end
end
end
Expand Down
96 changes: 58 additions & 38 deletions spec/metanorma/plugin/lutaml/lutaml_express_preprocessor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
END_SCHEMA;</sourcecode>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -126,7 +126,7 @@
END_SCHEMA;</sourcecode>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -273,7 +273,7 @@ def schema_anchors
END_SCHEMA;</sourcecode>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -323,46 +323,66 @@ def schema_anchors
TEXT
end

let(:output) do
let(:expected_output) do
<<~TEXT
#{BLANK_HDR}<sections><clause id="_" inline-header="false" obligation="normative"><title>annotated_3d_model_data_quality_criteria_schema</title>
<p id="_">Mine text</p>
<svgmap><figure id="_">
<image src="#{File.expand_path(fixtures_path('measure_schemaexpg5.svg'))}" id="_" mimetype="image/svg+xml" height="auto" width="auto"></image>
</figure><target href="1"><eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref></target><target href="2"><eref style="short" bibitemid="express_measure_schemaexpg4" citeas="">measure_schemaexpg4</eref></target><target href="3"><eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref></target></svgmap></clause>
<clause id="_" inline-header="false" obligation="normative">
<title>annotated_3d_model_data_quality_criteria_schema</title>
<p id="_">Mine text</p>
<svgmap>
<figure id="_">
<image
src="#{File.expand_path(fixtures_path('measure_schemaexpg5.svg'))}"
id="_" mimetype="image/svg+xml" height="auto" width="auto"></image>
</figure>
<target href="1">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
</target>
<target href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas="">measure_schemaexpg4</eref>
</target>
<target href="3">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
</target>
</svgmap>
</clause></sections>
<bibliography><references hidden="true" normative="false"><bibitem id="express_measure_schema" type="internal">
<docidentifier type="repository">express/measure_schema</docidentifier>
</bibitem>
<bibitem id="express_measure_schemaexpg4" type="internal">
<docidentifier type="repository">express/measure_schemaexpg4</docidentifier>
</bibitem>
</references></bibliography></standard-document>
#{BLANK_HDR}
<sections>
<clause id="_" inline-header="false" obligation="normative">
<title>annotated_3d_model_data_quality_criteria_schema</title>
<p id="_">Mine text</p>
<svgmap>
<figure id="_">
<image src="#{File.expand_path(fixtures_path('measure_schemaexpg5.svg'))}" mimetype="image/svg+xml" id="_" height="auto" width="auto"/>
</figure>
<target href="1">
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
<target href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas=""><display-text>measure_schemaexpg4</display-text></eref>
</target>
<target href="3">
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
</svgmap>
</clause>
<clause id="_" inline-header="false" obligation="normative">
<title>annotated_3d_model_data_quality_criteria_schema</title>
<p id="_">Mine text</p>
<svgmap>
<figure id="_">
<image src="#{File.expand_path(fixtures_path('measure_schemaexpg5.svg'))}" mimetype="image/svg+xml" id="_" height="auto" width="auto"/>
</figure>
<target href="1">
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
<target href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas=""><display-text>measure_schemaexpg4</display-text></eref>
</target>
<target href="3">
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
</svgmap>
</clause>
</sections>
<bibliography>
<references hidden="true" normative="false">
<bibitem id="express_measure_schema" type="internal">
<docidentifier type="repository">express/measure_schema</docidentifier>
</bibitem>
<bibitem id="express_measure_schemaexpg4" type="internal">
<docidentifier type="repository">express/measure_schemaexpg4</docidentifier>
</bibitem>
</references>
</bibliography>
</metanorma>
TEXT
end

it "correctly renders input" do
expect(xml_string_content(metanorma_process(input)))
.to(be_equivalent_to(output))
output = remove_xml_whitespaces(
xml_string_content(metanorma_process(input)))
expect(output)
.to(be_equivalent_to(remove_xml_whitespaces(expected_output)))
end
end
end
Expand Down
60 changes: 35 additions & 25 deletions spec/metanorma/plugin/lutaml/lutaml_text_preprocessor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{% endfor %}
{% endfor %}</sourcecode>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -135,7 +135,7 @@
explicit → </p>
</clause></clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -189,7 +189,17 @@
<p id="_">Mine text</p>
<svgmap><figure id="_">
<image src="#{File.expand_path(fixtures_path('measure_schemaexpg5.svg'))}" id="_" mimetype="image/svg+xml" height="auto" width="auto"></image>
</figure><target href="1"><eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref></target><target href="2"><eref style="short" bibitemid="express_measure_schemaexpg4" citeas="">measure_schemaexpg4</eref></target><target href="3"><eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref></target></svgmap></clause>
</figure>
<target href="1">
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
<target href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas=""><display-text>measure_schemaexpg4</display-text></eref>
</target>
<target href="3">
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
</svgmap></clause>
<clause id="_" inline-header="false" obligation="normative">
<title>annotated_3d_model_data_quality_criteria_schema</title>
<p id="_">Mine text</p>
Expand All @@ -200,13 +210,13 @@
id="_" mimetype="image/svg+xml" height="auto" width="auto"></image>
</figure>
<target href="1">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
<target href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas="">measure_schemaexpg4</eref>
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas=""><display-text>measure_schemaexpg4</display-text></eref>
</target>
<target href="3">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
</svgmap>
</clause></sections>
Expand All @@ -216,7 +226,7 @@
<bibitem id="express_measure_schemaexpg4" type="internal">
<docidentifier type="repository">express/measure_schemaexpg4</docidentifier>
</bibitem>
</references></bibliography></standard-document>
</references></bibliography></metanorma>
TEXT
end

Expand Down Expand Up @@ -269,7 +279,7 @@
<link target="http://test.com/include1.csv"/>
</p></clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -320,7 +330,7 @@
<link target="http://test.com/include1.csv"/>
</p></clause>
</sections>
</standard-document>
</metanorma>
TEXT
end
it "correctly renders input" do
Expand Down Expand Up @@ -367,13 +377,13 @@
height="auto" width="auto"></image>
</figure>
<target href="1">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
<target href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas="">measure_schemaexpg4</eref>
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas=""><display-text>measure_schemaexpg4</display-text></eref>
</target>
<target href="3">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
</svgmap>
</clause>
Expand All @@ -385,7 +395,7 @@
<docidentifier type="repository">express/measure_schemaexpg4</docidentifier>
</bibitem>
</references></bibliography>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -443,7 +453,7 @@
<title>Activity_method_characterized_mim</title>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -497,7 +507,7 @@
<title>annotated_3d_model_data_quality_criteria_schema</title>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -548,7 +558,7 @@
<title>annotated_3d_model_data_quality_criteria_schema</title>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -642,7 +652,7 @@
<title>annotated_3d_model_data_quality_criteria_schema</title>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -703,15 +713,15 @@
</figure>
<target
href="1">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
<target
href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas="">measure_schemaexpg4</eref>
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas=""><display-text>measure_schemaexpg4</display-text></eref>
</target>
<target
href="3">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
</svgmap>
</clause>
Expand All @@ -726,15 +736,15 @@
</figure>
<target
href="1">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
<target
href="2">
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas="">measure_schemaexpg4</eref>
<eref style="short" bibitemid="express_measure_schemaexpg4" citeas=""><display-text>measure_schemaexpg4</display-text></eref>
</target>
<target
href="3">
<eref style="short" bibitemid="express_measure_schema" citeas="">measure_schema</eref>
<eref style="short" bibitemid="express_measure_schema" citeas=""><display-text>measure_schema</display-text></eref>
</target>
</svgmap>
</clause>
Expand All @@ -749,7 +759,7 @@
<docidentifier type="repository">express/measure_schemaexpg4</docidentifier>
</bibitem>
</references></bibliography>
</standard-document>
</metanorma>
TEXT
end

Expand Down Expand Up @@ -784,7 +794,7 @@
<p id="_">My content</p>
</clause>
</sections>
</standard-document>
</metanorma>
TEXT
end

Expand Down
Loading

0 comments on commit a9d537d

Please sign in to comment.