Skip to content

Commit

Permalink
More adjustments prepping to M4 unit tests - usnistgov#81 usnistgov#186
Browse files Browse the repository at this point in the history
… #201 - now everything is green or grey (pending) no pink
  • Loading branch information
wendellpiez authored and david-waltermire committed Apr 28, 2022
1 parent 47349ae commit c9a4f14
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
4 changes: 2 additions & 2 deletions toolchains/xslt-M4/compose/testing/1_collected/collect.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<x:expect label="Modules collected, no loops" href="working_metaschema-COLLECTED.xml" select="/*"/>
</x:scenario>

<x:scenario label="Metaschema skeleton">
<x:scenario label="Metaschema skeleton" pending="update">
<!-- Mysteriously, sometimes select="*" makes XSpec problems go away, other times not. -->
<x:context mode="acquire">
<METASCHEMA>
Expand Down Expand Up @@ -74,7 +74,7 @@

</x:expect>
</x:scenario>
<x:scenario label="Nested locals">
<x:scenario label="Nested locals" pending="update">
<!-- Mysteriously, sometimes select="*" makes XSpec problems go away, other times not. -->
<x:context mode="acquire">
<METASCHEMA>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="../../metaschema-prune-unused-definitions-a9.xsl"
<x:description stylesheet="../../metaschema-prune-unused-definitions.xsl"
run-as="external"
xmlns:x="http://www.jenitennison.com/xslt/xspec"
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:mv="http://csrc.nist.gov/ns/metaschema/test/variable">
Expand Down Expand Up @@ -43,10 +43,10 @@
<EXCEPTION problem-type="unused-definition">REMOVING unused field definition for 'unused-field' from nestedmessy.</EXCEPTION>
</METASCHEMA>
</x:expect>
<x:expect label="exactly two unused definitions are reported as exceptions" test="count($x:result//m:EXCEPTION[@problem-type='unused-definition']) eq 2"/>
<x:expect label="an exception is reported for the unused assembly" test="$x:result//m:EXCEPTION[@problem-type='unused-definition'] = 'REMOVING unused assembly definition for ''unused-assembly'' from nestedmessy.'"/>
<x:expect label="an exception is reported for the unused field" test="$x:result//m:EXCEPTION[@problem-type='unused-definition'] = 'REMOVING unused field definition for ''unused-field'' from nestedmessy.'"/>
<x:expect label="no assembly is defined for an assembly named 'unused-assembly'" test="empty($x:result//m:define-assembly[@name='unused-assembly'])"/>
<x:expect label="no field is defined for a field named 'unused field'" test="empty($x:result//m:define-field[@name='unused-field'])"/>
<x:expect label="exactly two unused definitions are reported as exceptions" test="count(//m:EXCEPTION[@problem-type='unused-definition']) eq 2"/>
<x:expect label="an exception is reported for the unused assembly" test="//m:EXCEPTION[@problem-type='unused-definition'] = 'REMOVING unused assembly definition for ''unused-assembly'' from nestedmessy.'"/>
<x:expect label="an exception is reported for the unused field" test="//m:EXCEPTION[@problem-type='unused-definition'] = 'REMOVING unused field definition for ''unused-field'' from nestedmessy.'"/>
<x:expect label="no assembly is defined for an assembly named 'unused-assembly'" test="empty(//m:define-assembly[@name='unused-assembly'])"/>
<x:expect label="no field is defined for a field named 'unused field'" test="empty(//m:define-field[@name='unused-field'])"/>
</x:scenario>
</x:description>
32 changes: 25 additions & 7 deletions toolchains/xslt-M4/compose/testing/7_digesting/digested.xspec
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:opr="http://csrc.nist.gov/ns/oscal/profile-resolution" xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="../../metaschema-digest.xsl">

<x:description stylesheet="../../metaschema-digest.xsl"
run-as="external"
xmlns:x="http://www.jenitennison.com/xslt/xspec"
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:mv="http://csrc.nist.gov/ns/metaschema/test/variable">

<!-- metaschema-digest.xsl
- flattens modular structure
- flattens modular structure (removing any residual METASCHEMA/METASCHEMA)
- marks definitions with their module of origin
- copies @as-type info for defaulting
- casts example markup into target namespace (as found in the metaschema)
-->
<x:scenario label="Working metaschema">
<x:context href="../2_reduced2/working_metaschema-REDUCED1.xml" select="*" mode="digest" />
<x:scenario label="Working metaschema" pending="build out">
<!-- TODO wire to result of predecessor step -->
<x:context href="../6_resolved2/expected/working_metaschema-RESOLVED.xml" select="*" mode="digest" />
<x:expect label="Basic metaschema composition" href="working_metaschema-DIGESTED.xml" select="*"/>
</x:scenario>

<x:scenario label="Handling nested METASCHEMAs from modules">
<x:context mode="digest">
<METASCHEMA>
<METASCHEMA>
<METASCHEMA/>
</METASCHEMA>
<METASCHEMA/>
</METASCHEMA>
</x:context>
<x:expect label="only a top-level METASCHEMA is given">
<METASCHEMA/>
</x:expect>
<x:expect label="while a query also finds no others" test="count(descendant::m:METASCHEMA) eq 1"/>
</x:scenario>
</x:description>

0 comments on commit c9a4f14

Please sign in to comment.