--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xquery/trunk/XQuery__XQTSSequenceTypeSyntaxTests.st Mon Nov 10 18:05:47 2008 +0000
@@ -0,0 +1,51 @@
+"{ Package: 'stx:goodies/xmlsuite/xquery' }"
+
+"{ NameSpace: XQuery }"
+
+XQTSTestCase subclass:#XQTSSequenceTypeSyntaxTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'XQuery-Tests-XQTS'
+!
+
+
+!XQTSSequenceTypeSyntaxTests methodsFor:'tests'!
+
+test_sequence_type_1
+
+
+ | query result |
+
+ query := '
+(:*******************************************************:)
+(:Test: sequence-type-1 :)
+(:Written By: Carmelo Montanez :)
+(:Date: March 29, 2006 :)
+(:Purpose: Evaluate simple sequence type using instance of :)
+(: and integers. :)
+(:*******************************************************:)
+(: insert-start :)
+declare variable $input-context1 external;
+(: insert-end :)
+
+(1,2,3) instance of xs:integer*
+'.
+
+ self xqtsBind: 'input-context1' toContentsOf: 'emptydoc.xml'.
+
+ result := interpreter evaluate: query.
+
+ self
+ assert:
+ (self xqtsResultTextFromResult: result)
+ = (self xqtsResultTextFromFile: 'Basics/Types/SequenceTypeSyntax/truevalue.txt')
+
+ "Created: / 10-11-2008 / 17:20:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSSequenceTypeSyntaxTests class methodsFor:'documentation'!
+
+version
+ ^'$Id$'
+! !
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xquery/trunk/XQuery__XQTSStaticContextTests.st Mon Nov 10 18:05:47 2008 +0000
@@ -0,0 +1,49 @@
+"{ Package: 'stx:goodies/xmlsuite/xquery' }"
+
+"{ NameSpace: XQuery }"
+
+XQTSTestCase subclass:#XQTSStaticContextTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'XQuery-Tests-XQTS'
+!
+
+
+!XQTSStaticContextTests methodsFor:'tests'!
+
+test_static_context_1
+
+ | query result |
+
+ query := '
+(:*******************************************************:)
+(:Test: static-context-1 :)
+(:Written By: Carmelo Montanez :)
+(:Date: July 12, 2006 :)
+(:Purpose: Evaluate error condition XPST0001 :)
+(:*******************************************************:)
+
+declare namespace test = ''http://www.example.com'';
+
+(: insert-start :)
+declare variable $input-context1 external;
+(: insert-end :)
+
+<a/> instance of element(*, test:unknownType)
+'.
+
+ self xqtsBind: 'input-context1' toContentsOf: 'emptydoc.xml'.
+
+ self
+ should:[interpreter evaluate: query]
+ raiseErrorCodes: #('XPST0001' 'XPTY0004')
+
+ "Created: / 10-11-2008 / 17:21:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSStaticContextTests class methodsFor:'documentation'!
+
+version
+ ^'$Id$'
+! !
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xquery/trunk/XQuery__XQTSTestCase.st Mon Nov 10 18:05:47 2008 +0000
@@ -0,0 +1,111 @@
+"{ Package: 'stx:goodies/xmlsuite/xquery' }"
+
+"{ NameSpace: XQuery }"
+
+TestCase subclass:#XQTSTestCase
+ instanceVariableNames:'interpreter'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'XQuery-Tests-XQTS'
+!
+
+
+!XQTSTestCase class methodsFor:'accessing'!
+
+resources
+
+ ^Array with: XQTSTestResource
+
+ "Created: / 10-11-2008 / 16:23:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestCase class methodsFor:'testing'!
+
+isAbstract
+
+ ^self == XQTSTestCase
+
+ "Created: / 10-11-2008 / 16:22:09 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestCase methodsFor:'assertions'!
+
+should: block raiseErrorCodes: arrayOfErrorCodes
+
+ <resource: #skipInDebuggersWalkBack>
+
+ ^ self assert:
+ (self
+ executeShould:block
+ inScopeOf:(XQueryParserError, XQueryInterpreterError)
+ suchThat:[:ex|arrayOfErrorCodes includes:ex errorCode])
+
+ "Created: / 10-11-2008 / 16:53:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 10-11-2008 / 18:39:34 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestCase methodsFor:'initialization & release'!
+
+setUp
+
+ super setUp.
+ interpreter := XQueryInterpreter new.
+
+ "Created: / 10-11-2008 / 17:01:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestCase methodsFor:'private'!
+
+executeShould: aBlock inScopeOf: anExceptionalEvent suchThat: suchBlock
+
+ [aBlock value]
+ on: anExceptionalEvent
+ do: [:ex | ^suchBlock value: ex].
+ ^false.
+
+ "Created: / 10-11-2008 / 18:40:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestCase methodsFor:'xqts utilities'!
+
+xqtsBind: variableName toContentsOf: fileName
+
+ | variableValue document documentAdaptor |
+ document := XMLv2::Parser forDOM3 processDocumentInFilename:
+ (XQTSTestResource current xqtsInputFile: fileName).
+ documentAdaptor := XMLv2::XPathDOM3DocumentAdaptor new document: document.
+ variableValue := XQuerySequence withNode:
+ (XQueryAccessedNode new
+ documentAdaptor: documentAdaptor;
+ nodeId: documentAdaptor xpathDocument).
+ "This will end up with an error, because context
+ is created right before the evaluation begun...
+ Im looking for elegnt solution..."
+ "
+ interpreter
+ bindVar: variableName
+ to: fileName
+ "
+
+ "Created: / 10-11-2008 / 17:23:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+xqtsResultTextFromFile: fileName
+
+ ^(XQTSTestResource current xqtsResultFile: fileName) contents
+
+ "Created: / 10-11-2008 / 17:10:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+xqtsResultTextFromResult: xqueryResult
+
+ ^xqueryResult asDocumentFragment asXMLString
+
+ "Created: / 10-11-2008 / 17:10:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestCase class methodsFor:'documentation'!
+
+version
+ ^'$Id$'
+! !
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xquery/trunk/XQuery__XQTSTestResource.st Mon Nov 10 18:05:47 2008 +0000
@@ -0,0 +1,83 @@
+"{ Package: 'stx:goodies/xmlsuite/xquery' }"
+
+"{ NameSpace: XQuery }"
+
+TestResource subclass:#XQTSTestResource
+ instanceVariableNames:''
+ classVariableNames:'XQTSRoot'
+ poolDictionaries:''
+ category:'XQuery-Tests-XQTS'
+!
+
+
+!XQTSTestResource class methodsFor:'accessing'!
+
+xqtsRoot
+
+ "
+ self xqtsRoot
+ "
+
+ XQTSRoot ifNil:
+ [XQTSRoot := self xqtsRoots
+ at: OperatingSystem getHostName
+ ifAbsent:[Dialog requestDirectoryName:'Enter XQTS Root directory']].
+ ^XQTSRoot asFilename
+
+ "Created: / 10-11-2008 / 16:27:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+xqtsRoots
+
+ ^Dictionary withKeysAndValues:
+ #(
+ 'bruxa' '/data/XQTS'
+ )
+
+ "Created: / 10-11-2008 / 16:29:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestResource methodsFor:'accessing'!
+
+xqtsFile: aString
+
+ ^self xqtsRoot construct: (aString copy replaceAll:$/ with: Filename separator)
+
+ "Created: / 10-11-2008 / 16:31:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 10-11-2008 / 17:32:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+xqtsInputFile: aString
+
+ ^self xqtsFile:'TestSources/' , aString
+
+ "Created: / 10-11-2008 / 17:14:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+xqtsQueryFile: aString
+
+ ^self xqtsFile:'Queries/XQuery/' , aString
+
+ "Created: / 10-11-2008 / 17:13:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+xqtsResultFile: aString
+
+ ^self xqtsFile:'ExpectedTestResults/' , aString
+
+ "Created: / 10-11-2008 / 17:13:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+xqtsRoot
+
+ ^self class xqtsRoot
+
+ "Created: / 10-11-2008 / 16:23:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 10-11-2008 / 17:32:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!XQTSTestResource class methodsFor:'documentation'!
+
+version
+ ^'$Id$'
+! !
--- a/xquery/trunk/stx_goodies_xmlsuite_xquery.st Mon Oct 27 20:33:16 2008 +0000
+++ b/xquery/trunk/stx_goodies_xmlsuite_xquery.st Mon Nov 10 18:05:47 2008 +0000
@@ -30,7 +30,7 @@
#'stx:libwidg2' "HierarchicalItem - superclass of XQuery::VariableProxy "
)
- "Modified: / 22-10-2008 / 10:21:24 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 10-11-2008 / 19:05:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!stx_goodies_xmlsuite_xquery class methodsFor:'description - contents'!
@@ -52,6 +52,8 @@
#'XQuery::WorkspaceApplication'
#'XQuery::WorkspaceUI'
#'XQuery::XPathDocumentAdaptorProxy'
+ #'XQuery::XQTSTestCase'
+ #'XQuery::XQTSTestResource'
#'XQuery::XQueryAbstractNode'
#'XQuery::XQueryCompiler'
#'XQuery::XQueryContext'
@@ -167,6 +169,8 @@
#'XQuery::TypeNode'
#'XQuery::TypeXSAnyAtomicType'
#'XQuery::UserDefinedFunction'
+ #'XQuery::XQTSSequenceTypeSyntaxTests'
+ #'XQuery::XQTSStaticContextTests'
#'XQuery::XQueryAccessedNode'
#'XQuery::XQueryConstructedNode'
#'XQuery::AstInsertAfterExpr'
@@ -198,7 +202,7 @@
#'XQuery::TypeXSNCName'
)
- "Modified: / 22-10-2008 / 10:21:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 10-11-2008 / 19:05:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
extensionMethodNames