require "spec_helper"
require "open3"
RSpec.describe Asciidoctor::Standoc do
it "processes format-specific pass blocks" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[format="rfc,html"]
++++
X > Y
++++
INPUT
#{BLANK_HDR}
<abc>X > Y</abc>
OUTPUT
end
it "processes Metanorma XML pass blocks" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
++++
X >
++++
++++
Y
++++
INPUT
#{BLANK_HDR}
X > Y
OUTPUT
end
it "processes open blocks" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
--
x
y
z
--
INPUT
#{BLANK_HDR}
x
y
z
OUTPUT
end
it "processes stem blocks" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[stem%inequality,number=3,keep-with-next=true,keep-lines-together=true]
++++
r = 1 %
r = 1 %
++++
[stem%unnumbered]
++++
FΑ
++++
[latexmath,subsequence=A]
++++
M =
\\begin{bmatrix}
-\\sin λ_0 & \\cos λ_0 & 0 \\\\
-\\sin φ_0 \\cos λ_0 & -\\sin φ_0 \\sin λ_0 & \\cos φ_0 \\\\
\\cos φ_0 \\cos λ_0 & \\cos φ_0 \\sin λ_0 & \\sin φ_0
\\end{bmatrix}
++++
INPUT
#{BLANK_HDR}
OUTPUT
end
it "ignores review blocks unless document is in draft mode" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[foreword]]
.Foreword
Foreword
[reviewer=ISO,date=20170101,from=foreword,to=foreword]
****
A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
****
INPUT
#{BLANK_HDR}
Foreword
OUTPUT
end
it "processes review blocks if document is in draft mode" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:draft: 1.2
[[foreword]]
.Foreword
Foreword
[reviewer=ISO,date=20170101,from=foreword,to=foreword]
****
A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
****
INPUT
Document title1.2enpublished#{Date.today.year}article
Foreword
A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
For further information on the Foreword, see ISO/IEC Directives, Part 2, 2016, Clause 12.
OUTPUT
end
it "processes term notes" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
=== Term1
NOTE: This is a note
[NOTE,keep-separate=true]
====
XYZ
====
INPUT
#{BLANK_HDR}
Terms and definitions
For the purposes of this document, the following terms and definitions apply.
Term1
This is a note
XYZ
OUTPUT
end
it "processes term notes as plain notes in nonterm clauses" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
NOTE: This is not a termnote
EXAMPLE: This is not a termexample
[.nonterm]
=== Term1
NOTE: This is a note
INPUT
#{BLANK_HDR}
Terms and definitions
No terms and definitions are listed in this document.
This is not a termnote
Term1
This is a note
OUTPUT
end
it "processes term notes as plain notes in definitions subclauses of terms & definitions" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
=== Term1
=== Symbols
NOTE: This is a note
INPUT
#{BLANK_HDR}
Terms, definitions and symbols
For the purposes of this document, the following terms and definitions apply.
Term1Symbols
This is a note
OUTPUT
end
it "processes notes" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
NOTE: This is a note
== Clause 1
[[ABC]]
NOTE: This is a note
[NOTE,keep-separate=true,number=7,subsequence=A,beforeclauses=true,keep-with-next=true,keep-lines-together=true,type=classified]
====
XYZ
====
INPUT
#{BLANK_HDR}
Foreword
This is a note
XYZ
Clause 1
This is a note
OUTPUT
end
it "processes literals" do
expect((strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to (<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[alt=Literal,keep-with-next=true,keep-lines-together=true]
....
FIGURATIVE
....
INPUT
#{BLANK_HDR}
<LITERAL>
FIGURATIVE
OUTPUT
end
it "processes simple admonitions with Asciidoc names" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
INPUT
#{BLANK_HDR}
Only use paddy or parboiled rice for the determination of husked rice yield.
OUTPUT
end
it "processes complex admonitions with non-Asciidoc names" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[CAUTION,type=Safety Precautions,keep-with-next="true",keep-lines-together="true"]
.Precautions
====
While werewolves are hardy community members, keep in mind the following dietary concerns:
. They are allergic to cinnamon.
. More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.
. Celery makes them sad.
====
INPUT
#{BLANK_HDR}
Precautions
While werewolves are hardy community members, keep in mind the following dietary concerns:
They are allergic to cinnamon.
More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.
Celery makes them sad.
OUTPUT
end
it "processes term examples" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
=== Term1
[[ABC]]
[example]
This is an example
INPUT
#{BLANK_HDR}
Terms and definitions
For the purposes of this document, the following terms and definitions apply.
Term1
This is an example
OUTPUT
end
it "processes term examples as plain examples in nonterm clauses" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
[.nonterm]
=== Term1
[example]
This is an example
INPUT
#{BLANK_HDR}
Terms and definitions
No terms and definitions are listed in this document.
Term1
This is an example
OUTPUT
end
it "processes term examples as plain examples in definitions subclauses of terms & definitions" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
=== Term1
=== Symbols
[example]
This is an example
INPUT
#{BLANK_HDR}
Terms, definitions and symbols
For the purposes of this document, the following terms and definitions apply.
Term1Symbols
This is an example
OUTPUT
end
it "processes examples" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[example,subsequence=A,keep-with-next=true,keep-lines-together=next]
.Title
====
This is an example
Amen
====
[example%unnumbered]
====
This is another example
====
[example,number=3]
====
This is yet another example
====
INPUT
#{BLANK_HDR}
Title
This is an example
Amen
This is another example
This is yet another example
OUTPUT
end
it "processes preambles" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
This is a preamble
== Section 1
INPUT
#{BLANK_HDR}
Foreword
This is a preamble
Section 1
OUTPUT
end
it "processes preambles with titles" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
.Preamble
This is a preamble
== Section 1
INPUT
#{BLANK_HDR}
Foreword
This is a preamble
Section 1
OUTPUT
end
it "processes subfigures" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[figureC-2]]
.Stages of gelatinization
====
.Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
image::spec/examples/rice_images/rice_image3_1.png[]
.Intermediate stages: Some fully gelatinized kernels are visible
image::spec/examples/rice_images/rice_image3_2.png[]
.Final stages: All kernels are fully gelatinized
image::spec/examples/rice_images/rice_image3_3.png[]
====
INPUT
#{BLANK_HDR}
Stages of gelatinizationInitial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)Intermediate stages: Some fully gelatinized kernels are visibleFinal stages: All kernels are fully gelatinized
OUTPUT
end
it "processes figures within examples" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[figureC-2]]
.Stages of gelatinization
====
.Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
image::spec/examples/rice_images/rice_image3_1.png[]
Text
.Intermediate stages: Some fully gelatinized kernels are visible
image::spec/examples/rice_images/rice_image3_2.png[]
.Final stages: All kernels are fully gelatinized
image::spec/examples/rice_images/rice_image3_3.png[]
====
INPUT
#{BLANK_HDR}
Stages of gelatinizationInitial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
Text
Intermediate stages: Some fully gelatinized kernels are visibleFinal stages: All kernels are fully gelatinized
OUTPUT
end
it "processes images" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[%unnumbered,number=3]
.Split-it-right sample divider
image::spec/examples/rice_images/rice_image1.png[alttext]
INPUT
#{BLANK_HDR}
Split-it-right sample divider
OUTPUT
end
it "processes data URI images" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[subsequence=A]
.Split-it-right sample divider
image::data:image/*;base64,iVBORw0KGgoAAAANSUhEUgAAAM4AAAAjCAYAAADcxTWYAAAAAXNSR0IArs4c6QAAExZJREFUeAHtnQmYVcWVx6t3oGn2xRVwQUEQIiKi0YgGVNxmjBCXQcOHkTiaxIwy6mSMqKhJXJKMcUky7kZjBDUoKsEIqIggLsEFUFFAFGSHpmm2Xub3v30LDuW7bwEUP+ed7/u9OudU3br3VtWpqnvfoykYdN2zbgekEccOgZOhNzSHDTAbJsBfYS5sl2wsLHVF9bXu5x/e4w6oWuBWl1RsVz35g3ZtC7TYvNZ90LSju7Hz+a62oMiV1W3atRe0E85evAN1DOLY38GeQR0a3W3hO3A93AL/CXnJt8A3pgUKt/NOruG40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zxBjwgfM99KwCR6uMfqqhH3VK3wHRyvBViO57zg6cKJuBnWvQ6HKyqTfVZWsm/yhVxjfE14v7UNBItHKJTDKTAo/mOhq17fEnUlR+YM5SafRSo0t9zNiDjJ5WLeWLM/2oc1lpK744W8tfScn1ctNWn8/Mt8DbNMFrOTTDZMpG4z/XkXg0B/qgmIJu95vV2F60r7aifbcuUrI/9I60DB+NCZzK4qbuvg6nRT/VKGflCR4uM9SQz863QNoW0E7kcDgb7oN3YDnoeVnPWmthLmhndS4cC1UQ7fuVZit6PvEyzStxqm2KHgYVWE1in01GY/SIHWeSvm4zU+l1Tj8OXBH9MPCJ3Y9z5y582s0r3zubL0BTVZf35VsgqQUeJUNINOm3BD3GaBe1Br4gua44ijgvL3slTvWM41ed8iBP5hPGp1d5WZ1brzHbblrtHtnrJDeTf/3ZZuOqbZY5U2dezbfAzmiBDVSixxC9sUwZNDpJVoNXBRGtJP75RrbfekmXKHD8S4FUK84s8vU6VNIaCiItw4e2Zs35YeDy0hbuyd378Xsn/tJN6j9KmKGmfHa+BXZeC+QSOHrDMjU+9W9Jw1eT2hPaFUffa4TSH8dI6AeqLyvRS4Fm/OxmCX/dRv/Vh4InL/kW2JUtoH1ctqLRegzotfI/Ew7SqiNpCtqu6dttK/MwrrOOXPRS/nSq/vZwbXaLVS5V58vmWyCnFshlxVHFNZAUNMr3zzbaqqVacVRmuyXFjzu3u678gfkW2JEWyDVwMp3rLgqsAr2h+Kq+dMx0Tfn8fAvs9Bb4P/RCZMfd+bNlAAAAAElFTkSuQmCC[alttext]
INPUT
#{BLANK_HDR}
Split-it-right sample divider
OUTPUT
end
it "accepts attributes on images" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[height=4,width=3,alt="IMAGE",filename="riceimg1.png",titleattr="TITLE"]
.Caption
image::spec/examples/rice_images/rice_image1.png[]
INPUT
#{BLANK_HDR}
Caption
OUTPUT
end
it "accepts auto for width and height attributes on images" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[height=4,width=auto]
image::spec/examples/rice_images/rice_image1.png[]
INPUT
#{BLANK_HDR}
OUTPUT
end
it "processes inline images with width and height attributes on images" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
Hello image:spec/examples/rice_images/rice_image1.png[alt, 4, 3], how are you?
INPUT
#{BLANK_HDR}
Hello , how are you?
OUTPUT
end
it "processes images as datauri" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to include '
This para is right-aligned.
OUTPUT
end
it "processes blockquotes" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[quote, ISO, "ISO7301,section 1",align="right",keep-with-next=true,keep-lines-together=true]
____
Block quotation
____
INPUT
#{BLANK_HDR}
1ISO
Block quotation
OUTPUT
end
it "processes source code" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
.Caption
[source%unnumbered,ruby,number=3,filename=sourcecode1.rb,keep-with-next=true,keep-lines-together=true]
--
puts "Hello, world."
%w{a b c}.each do |x|
puts x
end
--
INPUT
#{BLANK_HDR}
Captionputs "Hello, world."
%w{a b c}.each do |x|
puts x
end
OUTPUT
end
it "processes callouts" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
[source,ruby]
--
puts "Hello, world." <1>
%w{a b c}.each do |x|
puts x <2>
end
--
<1> This is one callout
<2> This is another callout
INPUT
#{BLANK_HDR}
puts "Hello, world." 1
%w{a b c}.each do |x|
puts x 2
end
This is one callout
This is another callout
OUTPUT
end
it "processes unmodified term sources" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
=== Term1
[.source]
<>
=== Term2
Definition
[.source]
{{IEV:xyz}}
[.source]
{{IEV:xyz,t1}}
[.source]
{{IEV:xyz,t1,t2}}
INPUT
#{BLANK_HDR}
Terms and definitions
For the purposes of this document,
the following terms and definitions apply.
Term11Term2
Definition
t1t1
OUTPUT
end
it "processes modified term sources" do
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
#{ASCIIDOC_BLANK_HDR}
== Terms and Definitions
=== Term1
[.source]
<>, with adjustments
=== Term2
Definition
[.source]
{{IEV:xyz}}, with adjustments
INPUT
#{BLANK_HDR}
Terms and definitions
For the purposes of this document,
the following terms and definitions apply.
Term11
with adjustments
Term2
Definition
with adjustments
OUTPUT
end
it "processes recommendation" do
input = <<~"INPUT"
#{ASCIIDOC_BLANK_HDR}
[.recommendation,label="/ogc/recommendation/wfs/2",subject="user",inherit="/ss/584/2015/level/1; /ss/584/2015/level/2",options="unnumbered",type=verification,model=ogc]
====
I recommend this
====
INPUT
output = <<~"OUTPUT"
#{BLANK_HDR}
user/ss/584/2015/level/1/ss/584/2015/level/2
I recommend this
OUTPUT
expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
end
it "processes requirement" do
input = <<~"INPUT"
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[.requirement,subsequence="A",inherit="/ss/584/2015/level/1 & /ss/584/2015/level/2",number=3,keep-with-next=true,keep-lines-together=true]
.Title
====
I recommend this
====
INPUT
output = <<~"OUTPUT"
#{BLANK_HDR}
Title/ss/584/2015/level/1 & /ss/584/2015/level/2
I recommend this
OUTPUT
expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
end
it "processes permission" do
input = <<~"INPUT"
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[.permission]
====
I recommend this
====
INPUT
output = <<~"OUTPUT"
#{BLANK_HDR}
I recommend this
OUTPUT
expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
end
it "processes nested permissions" do
input = <<~"INPUT"
#{ASCIIDOC_BLANK_HDR}
[.permission]
====
I permit this
=====
Example 2
=====
[.permission]
=====
I also permit this
=====
====
INPUT
output = <<~"OUTPUT"
#{BLANK_HDR}
I permit this
Example 2
I also permit this
OUTPUT
expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
end
it "processes recommendation with internal markup of structure" do
input = <<~"INPUT"
#{ASCIIDOC_BLANK_HDR}
[[ABC]]
[.recommendation,label="/ogc/recommendation/wfs/2",subject="user",classification="control-class:Technical;priority:P0;family:System & Communications Protection,System and Communications Protocols",obligation="permission,recommendation",filename="reqt1.rq"]
====
I recommend _this_.
[.specification,type="tabular",keep-with-next=true,keep-lines-together=true]
--
This is the object of the recommendation:
|===
|Object |Value
|Mission | Accomplished
|===
--
As for the measurement targets,
[.measurement-target]
--
The measurement target shall be measured as:
[stem]
++++
r/1 = 0
++++
--
[.verification]
--
The following code will be run for verification:
[source,CoreRoot]
----
CoreRoot(success): HttpResponse
if (success)
recommendation(label: success-response)
end
----
--
[.import%exclude]
--
[source,CoreRoot]
----
success-response()
----
--
====
INPUT
output = <<~"OUTPUT"
#{BLANK_HDR}
usercontrol-classTechnicalpriorityP0familySystem & Communications ProtectionfamilySystem and Communications Protocols
I recommend this.
This is the object of the recommendation:
Object
Value
Mission
Accomplished
As for the measurement targets,
The measurement target shall be measured as:
The following code will be run for verification:
CoreRoot(success): HttpResponse
if (success)
recommendation(label: success-response)
endsuccess-response()
OUTPUT
expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
end
end