Skip to content

Commit

Permalink
Update opr:oscal-version and its test for error handling
Browse files Browse the repository at this point in the history
Now that opr:oscal-version returns item()+ to accommodate
error PI, output of $source should use xsl:sequence instead
of xsl:value-of to retain string data type. XSpec tests
for this function should expect PI, not error map.
  • Loading branch information
galtm authored and aj-stein-nist committed Sep 28, 2023
1 parent f8f5941 commit 571a2a1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/utils/resolver-pipeline/testing/2_metadata/metadata.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@
</selection>
</profile>
</x:context>
<x:expect label="Error"
test="$x:result instance of map(*) and $x:result('err') instance of map(*)"/>
<x:expect label="oscal-version containing PI indicating a terminating error"
test="exists($x:result/self::o:oscal-version/processing-instruction('message-handler')[starts-with(.,'Terminating ')])"/>
</x:scenario>
<x:scenario label="Most recent version is in profile metadata">
<x:context select="/o:profile/o:metadata/o:oscal-version">
Expand Down Expand Up @@ -289,16 +289,16 @@
<x:param name="source" select="'1.0.0'"/>
<x:param name="imported" select="('1.0.0','1.0.1')"/>
</x:call>
<x:expect label="Error"
test="$x:result instance of map(*) and $x:result('err') instance of map(*)"/>
<x:expect label="PI indicating a terminating error"
test="exists($x:result/self::processing-instruction('message-handler')[starts-with(.,'Terminating ')])"/>
</x:scenario>
<x:scenario label="Imported document has a newer pre-release identifier" catch="yes">
<x:call function="opr:oscal-version">
<x:param name="source" select="'1.0.1-rc1'"/>
<x:param name="imported" select="('1.0.0','1.0.1-rc2')"/>
</x:call>
<x:expect label="Error"
test="$x:result instance of map(*) and $x:result('err') instance of map(*)"/>
<x:expect label="PI indicating a terminating error"
test="exists($x:result/self::processing-instruction('message-handler')[starts-with(.,'Terminating ')])"/>
</x:scenario>
</x:scenario>
<x:scenario label="Different major version">
Expand All @@ -314,8 +314,8 @@
<x:param name="source" select="'1.37.40'"/>
<x:param name="imported" select="('2.0','1.0.1')"/>
</x:call>
<x:expect label="Error"
test="$x:result instance of map(*) and $x:result('err') instance of map(*)"/>
<x:expect label="PI indicating a terminating error"
test="exists($x:result/self::processing-instruction('message-handler')[starts-with(.,'Terminating ')])"/>
</x:scenario>
</x:scenario>
</x:scenario>
Expand Down

0 comments on commit 571a2a1

Please sign in to comment.