From 47bfe3574745062400e360fca89a65ddc9da5eb3 Mon Sep 17 00:00:00 2001 From: Ghislain Fourny Date: Fri, 10 Sep 2021 13:49:18 +0200 Subject: [PATCH] Add tests. --- .../runtime-native-flwor/udt/type18.jq | 28 +++++++++++++ .../runtime-native-flwor/udt/type19.jq | 40 +++++++++++++++++++ .../runtime-native-flwor/udt/typeError17.jq | 19 +++++++++ .../runtime-native-flwor/udt/typeError18.jq | 18 +++++++++ .../runtime-native-flwor/udt/typeError19.jq | 19 +++++++++ .../runtime-native-flwor/udt/typeError20.jq | 28 +++++++++++++ .../runtime-native-flwor/udt/typeError21.jq | 19 +++++++++ 7 files changed, 171 insertions(+) create mode 100644 src/test/resources/test_files/runtime-native-flwor/udt/type18.jq create mode 100644 src/test/resources/test_files/runtime-native-flwor/udt/type19.jq create mode 100644 src/test/resources/test_files/runtime-native-flwor/udt/typeError17.jq create mode 100644 src/test/resources/test_files/runtime-native-flwor/udt/typeError18.jq create mode 100644 src/test/resources/test_files/runtime-native-flwor/udt/typeError19.jq create mode 100644 src/test/resources/test_files/runtime-native-flwor/udt/typeError20.jq create mode 100644 src/test/resources/test_files/runtime-native-flwor/udt/typeError21.jq diff --git a/src/test/resources/test_files/runtime-native-flwor/udt/type18.jq b/src/test/resources/test_files/runtime-native-flwor/udt/type18.jq new file mode 100644 index 0000000000..9729eb3c5d --- /dev/null +++ b/src/test/resources/test_files/runtime-native-flwor/udt/type18.jq @@ -0,0 +1,28 @@ +(:JIQS: ShouldNotParse; ErrorCode="XQST0012"; ErrorMetadata="LINE:1:COLUMN:0:" :) +declare type local:x as jsound verbose { + "kind" : "object", + "baseType" : "object", + "content" : [ + { "name" : "foo", "type" : "integer", "required" : true } + ], + "closed" : true +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + { "name" : "foo", "type" : "int" } + ] +}; + +validate type local:y* { + { "foo" : 2 } +}, +try { + validate type local:y* { + { } + } +} catch XQDY0027 { + "Success" +} \ No newline at end of file diff --git a/src/test/resources/test_files/runtime-native-flwor/udt/type19.jq b/src/test/resources/test_files/runtime-native-flwor/udt/type19.jq new file mode 100644 index 0000000000..172152d3aa --- /dev/null +++ b/src/test/resources/test_files/runtime-native-flwor/udt/type19.jq @@ -0,0 +1,40 @@ +(:JIQS: ShouldNotParse; ErrorCode="XQST0012"; ErrorMetadata="LINE:1:COLUMN:0:" :) +declare type local:x as jsound verbose { + "kind" : "object", + "baseType" : "object", + "content" : [ + { "name" : "foo", "type" : "local:a" } + ], + "closed" : true +}; + +declare type local:a as jsound verbose { + "kind" : "array", + "baseType" : "array", + "content" : "integer" +}; + +declare type local:b as jsound verbose { + "kind" : "array", + "baseType" : "local:a", + "content" : "int" +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + { "name" : "foo", "type" : "local:b" } + ] +}; + +validate type local:y* { + { "foo" : [ 2, 3 ] } +}, +try { + validate type local:y* { + { "foo" : [ 2103294587134059823, 3 ] } + } +} catch XQDY0027 { + "Success" +} \ No newline at end of file diff --git a/src/test/resources/test_files/runtime-native-flwor/udt/typeError17.jq b/src/test/resources/test_files/runtime-native-flwor/udt/typeError17.jq new file mode 100644 index 0000000000..dfa27f696a --- /dev/null +++ b/src/test/resources/test_files/runtime-native-flwor/udt/typeError17.jq @@ -0,0 +1,19 @@ +(:JIQS: ShouldNotParse; ErrorCode="XQST0012"; ErrorMetadata="LINE:1:COLUMN:0:" :) +declare type local:x as jsound verbose { + "kind" : "object", + "baseType" : "object", + "content" : [ + { "name" : "foo", "type" : "integer" } + ] +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + { "name" : "foo", "type" : "int" } + ], + "closed" : false +}; + +() \ No newline at end of file diff --git a/src/test/resources/test_files/runtime-native-flwor/udt/typeError18.jq b/src/test/resources/test_files/runtime-native-flwor/udt/typeError18.jq new file mode 100644 index 0000000000..5f95e3b71b --- /dev/null +++ b/src/test/resources/test_files/runtime-native-flwor/udt/typeError18.jq @@ -0,0 +1,18 @@ +(:JIQS: ShouldNotParse; ErrorCode="XQST0012"; ErrorMetadata="LINE:1:COLUMN:0:" :) +declare type local:x as jsound verbose { + "kind" : "object", + "baseType" : "object", + "content" : [ + { "name" : "foo", "type" : "integer" } + ] +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + { "name" : "bar", "type" : "date" } + ] +}; + +() \ No newline at end of file diff --git a/src/test/resources/test_files/runtime-native-flwor/udt/typeError19.jq b/src/test/resources/test_files/runtime-native-flwor/udt/typeError19.jq new file mode 100644 index 0000000000..8b7133896a --- /dev/null +++ b/src/test/resources/test_files/runtime-native-flwor/udt/typeError19.jq @@ -0,0 +1,19 @@ +(:JIQS: ShouldNotParse; ErrorCode="XQST0012"; ErrorMetadata="LINE:1:COLUMN:0:" :) +declare type local:x as jsound verbose { + "kind" : "object", + "baseType" : "object", + "content" : [ + { "name" : "foo", "type" : "integer" } + ], + "closed" : true +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + { "name" : "foo", "type" : "decimal" } + ] +}; + +() \ No newline at end of file diff --git a/src/test/resources/test_files/runtime-native-flwor/udt/typeError20.jq b/src/test/resources/test_files/runtime-native-flwor/udt/typeError20.jq new file mode 100644 index 0000000000..46b51253aa --- /dev/null +++ b/src/test/resources/test_files/runtime-native-flwor/udt/typeError20.jq @@ -0,0 +1,28 @@ +(:JIQS: ShouldNotParse; ErrorCode="XQST0012"; ErrorMetadata="LINE:1:COLUMN:0:" :) +declare type local:x as jsound verbose { + "kind" : "object", + "baseType" : "object", + "content" : [ + { "name" : "foo", "type" : "integer" } + ], + "closed" : false +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + ] +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + { "name" : "foo", "type" : "decimal" } + ] +}; + + + +() diff --git a/src/test/resources/test_files/runtime-native-flwor/udt/typeError21.jq b/src/test/resources/test_files/runtime-native-flwor/udt/typeError21.jq new file mode 100644 index 0000000000..08dc5dd738 --- /dev/null +++ b/src/test/resources/test_files/runtime-native-flwor/udt/typeError21.jq @@ -0,0 +1,19 @@ +(:JIQS: ShouldNotParse; ErrorCode="XQST0012"; ErrorMetadata="LINE:1:COLUMN:0:" :) +declare type local:x as jsound verbose { + "kind" : "object", + "baseType" : "object", + "content" : [ + { "name" : "foo", "type" : "integer", "required" : true } + ], + "closed" : true +}; + +declare type local:y as jsound verbose { + "kind" : "object", + "baseType" : "local:x", + "content" : [ + { "name" : "foo", "type" : "integer", "required" : false } + ] +}; + +() \ No newline at end of file