<test-group xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" name="ErrorsAndOptimization" featureOwner="Jonathan Robie">
   <GroupInfo>
      <title>Errors and Optimization</title>
      <description/>
   </GroupInfo>
   <test-case is-XPath2="true" name="errors-and-optimization-1" FilePath="ErrorsAndOptimization/" scenario="standard" Creator="Jonathan Robie">
      <description>Conditional and typeswitch expressions must not
      raise a dynamic error in respect of subexpressions occurring in
      a branch that is not selected</description>
      <spec-citation spec="XQuery" section-number="2.3.4" section-title="Errors and Optimization" section-pointer="id-errors-and-opt"/>
      <reflects-resolution>http://www.w3.org/Bugs/Public/show_bug.cgi?id=4446</reflects-resolution>
      <query name="errors-and-optimization-1" date="2010-02-18"/>
      <input-file role="principal-data" variable="input-context1">emptydoc</input-file>
      <output-file role="principal" compare="Text">errors-and-optimization-1.txt</output-file>
   </test-case>

   <test-case is-XPath2="true" name="errors-and-optimization-2" FilePath="ErrorsAndOptimization/" scenario="runtime-error" Creator="Jonathan Robie">
      <description>Conditional expressions must not return the value delivered by a
      branch unless that branch is selected.</description>
      <spec-citation spec="XQuery" section-number="2.3.4" section-title="Errors and Optimization" section-pointer="id-errors-and-opt"/>
      <reflects-resolution>http://www.w3.org/Bugs/Public/show_bug.cgi?id=4446</reflects-resolution>
      <query name="errors-and-optimization-2" date="2010-02-18"/>
      <input-file role="principal-data" variable="input-context1">emptydoc</input-file>
      <expected-error>FOAR0001</expected-error>
   </test-case>

   <test-case is-XPath2="false" name="errors-and-optimization-3" FilePath="ErrorsAndOptimization/" scenario="standard" Creator="Jonathan Robie">
      <description>To avoid unexpected errors caused by expression
      rewrite, tests that are designed to prevent dynamic errors
      should be expressed using conditional or typeswitch
      expressions.</description>
      <spec-citation spec="XQuery" section-number="2.3.4" section-title="Errors and Optimization" section-pointer="id-errors-and-opt"/>
      <reflects-resolution>http://www.w3.org/Bugs/Public/show_bug.cgi?id=4446</reflects-resolution>
      <query name="errors-and-optimization-3" date="2010-02-18"/>
      <input-file role="principal-data" variable="input-context1">emptydoc</input-file>
      <output-file role="principal" compare="Text">errors-and-optimization-3.txt</output-file>
   </test-case>

   <test-case is-XPath2="true" name="errors-and-optimization-4" FilePath="ErrorsAndOptimization/" scenario="runtime-error" Creator="Jonathan Robie">
      <description>If a processor evaluates an operand E (wholly or in
      part), then it is required to establish that the actual value of
      the operand E does not violate any constraints on its
      cardinality.</description>
      <spec-citation spec="XQuery" section-number="2.3.4" section-title="Errors and Optimization" section-pointer="id-errors-and-opt"/>
      <reflects-resolution>http://www.w3.org/Bugs/Public/show_bug.cgi?id=4446</reflects-resolution>
      <query name="errors-and-optimization-4" date="2010-02-18"/>
      <input-file role="principal-data" variable="input-context1">emptydoc</input-file>
      <expected-error>XPTY0004</expected-error>
   </test-case>

   <test-case is-XPath2="false" name="errors-and-optimization-5" FilePath="ErrorsAndOptimization/" scenario="runtime-error" Creator="Jonathan Robie">
      <description>If a processor evaluates an operand E (wholly or
      in part), then it is required to establish that the actual value
      of the operand E does not violate any constraints on its
      cardinality.</description>
      <spec-citation spec="XQuery" section-number="2.3.4" section-title="Errors and Optimization" section-pointer="id-errors-and-opt"/>
      <reflects-resolution>http://www.w3.org/Bugs/Public/show_bug.cgi?id=4446</reflects-resolution>
      <query name="errors-and-optimization-5" date="2010-02-18"/>
      <input-file role="principal-data" variable="input-context1">emptydoc</input-file>
      <expected-error>XPTY0004</expected-error>
   </test-case>

   <test-case is-XPath2="true" name="errors-and-optimization-6" FilePath="ErrorsAndOptimization/" scenario="runtime-error" Creator="Jonathan Robie">
      <description>Expressions must not be rewritten in such a way as
      to create or remove static errors.</description>
      <spec-citation spec="XQuery" section-number="2.3.4" section-title="Errors and Optimization" section-pointer="id-errors-and-opt"/>
      <reflects-resolution>http://www.w3.org/Bugs/Public/show_bug.cgi?id=4446</reflects-resolution>
      <query name="errors-and-optimization-6" date="2010-02-18"/>
      <input-file role="principal-data" variable="input-context1">emptydoc</input-file>
      <expected-error>XPST0017</expected-error>
   </test-case>

   <test-case is-XPath2="false" name="errors-and-optimization-7" FilePath="ErrorsAndOptimization/" scenario="runtime-error" Creator="Jonathan Robie">
      <description>Expressions must not be rewritten in such a way as
      to create or remove static errors.</description>
      <spec-citation spec="XQuery" section-number="2.3.4" section-title="Errors and Optimization" section-pointer="id-errors-and-opt"/>
      <reflects-resolution>http://www.w3.org/Bugs/Public/show_bug.cgi?id=4446</reflects-resolution>
      <query name="errors-and-optimization-7" date="2010-02-18"/>
      <input-file role="principal-data" variable="input-context1">emptydoc</input-file>
      <expected-error>XPST0081</expected-error>
   </test-case>

</test-group>
