Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test terminates with FOTY0012 in test:report-sequence #151

Closed
AirQuick opened this issue Dec 4, 2017 · 1 comment · Fixed by #385 or #553
Closed

Test terminates with FOTY0012 in test:report-sequence #151

AirQuick opened this issue Dec 4, 2017 · 1 comment · Fixed by #385 or #553
Labels

Comments

@AirQuick
Copy link
Member

AirQuick commented Dec 4, 2017

(This description has been edited heavily so that the problem can be reproduced both on XSLT and XQuery.)

Can be reproduced on cbf9087:

xspec-151.xml

<?xml version="1.0" encoding="UTF-8"?>
<test-mix:fooElement xmlns:test-mix="x-urn:test-mix">
	<test-mix:barElement />
</test-mix:fooElement>

xspec-151.xsd (defines <fooElement> of fooType):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="x-urn:test-mix"
	xmlns:test-mix="x-urn:test-mix" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="fooElement" type="test-mix:fooType" />

	<xs:complexType name="fooType">
		<xs:sequence>
			<xs:element name="barElement" />
		</xs:sequence>
	</xs:complexType>
</xs:schema>

xspec-151.xsl (XSLT function to return a sequence of a fooType element and a string):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="#all" version="2.0" xmlns:test-mix="x-urn:test-mix"
	xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:import-schema namespace="x-urn:test-mix" schema-location="xspec-151.xsd" />

	<xsl:function as="item()+" name="test-mix:element-and-string">
		<xsl:variable as="element(test-mix:fooElement, test-mix:fooType)" name="typed-element">
			<xsl:copy-of select="doc('xspec-151.xml')/element()" validation="strict" />
		</xsl:variable>
		<xsl:sequence select="$typed-element, 'string'" />
	</xsl:function>
</xsl:stylesheet>

xspec-151.xquery (XQuery version of xspec-151.xsl):

module namespace test-mix = "x-urn:test-mix";

import schema "x-urn:test-mix" at "xspec-151.xsd";

declare function test-mix:element-and-string() as item()+ {
	let $typed-element as element(test-mix:fooElement, test-mix:fooType) := (
	validate strict {doc('xspec-151.xml')/element()}
	)
	return
		($typed-element, 'string')
};

xspec-151.xspec (always fails deliberately):

<?xml version="1.0" encoding="UTF-8"?>
<?xspec-test require-xquery-to-support-schema?>
<?xspec-test require-xslt-to-support-schema?>
<x:description query="x-urn:test-mix" query-at="xspec-151.xquery" stylesheet="xspec-151.xsl"
	xmlns:test-mix="x-urn:test-mix" xmlns:x="http://www.jenitennison.com/xslt/xspec">
	<x:scenario label="When the result is a mixture of a typed element and a string">
		<x:call function="test-mix:element-and-string" />
		<x:expect
			label="[Result] in the failure report HTML must wrap element and string separately"
			test="false()" />
	</x:scenario>
</x:description>

Running xspec-151.xspec should complete and should return a failure report. But actually it terminates:

XSLT

...
run-xslt-test:
...
     [java] Saxon-EE 9.8.0.12J from Saxonica
     [java] Java version 1.8.0_202
...
     [java] Type error at char 26 in xsl:value-of/@select on line 346 column 70 of generate-tests-utils.xsl:
     [java]   FOTY0012: Cannot get the typed value of an element (test-mix:fooElement) with element-only content
     [java] Cannot get the typed value of an element (test-mix:fooElement) with element-only content

BUILD FAILED
...

XQuery

...
run-xquery-test:
...
     [java] Saxon-EE 9.8.0.12J from Saxonica
     [java] Java version 1.8.0_202
...
     [java] Type error on line 201 column 52 of generate-query-utils.xql:
     [java]   FOTY0012: Cannot get the typed value of an element (test-mix:fooElement) with element-only content
     [java]   at test:report-sequence() (file:/.../xspec-151.xq#16)
     [java]   at local:d6e2() (file:/.../xspec-151.xq#37)
     [java] Query failed with type error: Cannot get the typed value of an element (test-mix:fooElement) with element-only content

BUILD FAILED
...
@AirQuick
Copy link
Member Author

Reopening for XQuery tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant