aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/jsonPath/tests
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/jsonPath/tests
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadsemanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/jsonPath/tests')
-rw-r--r--includes/js/dojox/jsonPath/tests/jsonPath.js211
-rw-r--r--includes/js/dojox/jsonPath/tests/module.js12
-rw-r--r--includes/js/dojox/jsonPath/tests/runTests.html9
3 files changed, 0 insertions, 232 deletions
diff --git a/includes/js/dojox/jsonPath/tests/jsonPath.js b/includes/js/dojox/jsonPath/tests/jsonPath.js
deleted file mode 100644
index b6f2ee6..0000000
--- a/includes/js/dojox/jsonPath/tests/jsonPath.js
+++ /dev/null
@@ -1,211 +0,0 @@
-if(!dojo._hasResource["dojox.jsonPath.tests.jsonPath"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.jsonPath.tests.jsonPath"] = true;
-dojo.provide("dojox.jsonPath.tests.jsonPath");
-dojo.require("dojox.jsonPath");
-
-
-dojox.jsonPath.tests.error = function(t, d, errData){
- // summary:
- // The error callback function to be used for all of the tests.
- d.errback(errData);
-}
-
-dojox.jsonPath.tests.testData= {
- store: {
- "book": [
- {
- "category":"reference",
- "author":"Nigel Rees",
- "title":"Sayings of the Century",
- "price":8.95
- },
- {
- "category":"fiction",
- "author":"Evelyn Waugh",
- "title":"Sword of Honour",
- "price":12.99
- },
- {
- "category":"fiction",
- "author":"Herman Melville",
- "title":"Moby Dick",
- "isbn":"0-553-21311-3",
- "price":8.99
- },
- {
- "category":"fiction",
- "author":"J. R. R. Tolkien",
- "title":"The Lord of the Rings",
- "isbn":"0-395-19395-8",
- "price":22.99
- }
- ],
- "bicycle": {
- "color":"red",
- "price":19.95
- }
- },
- "symbols":{"@.$;":5}
-}
-
-doh.register("dojox.jsonPath.tests.jsonPath",
- [
- {
- name: "$.store.book[*].author",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '["Nigel Rees","Evelyn Waugh","Herman Melville","J. R. R. Tolkien"]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$..author",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '["Nigel Rees","Evelyn Waugh","Herman Melville","J. R. R. Tolkien"]';
- doh.assertEqual(success,result);
-
- }
- },
- {
- name: "$.store.*",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],{"color":"red","price":19.95}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$.store..price",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[8.95,12.99,8.99,22.99,19.95]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$..book[(@.length-1)]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$..book[-1:]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$..book[0,1]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$..book[:2]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$..book[?(@.isbn)]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$..book[?(@.price<10)]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$.symbols[*]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[5]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$.symbols['@.$;']",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[5]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "$.symbols[(@[('@.$;')]?'@.$;':'@.$;')]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, this.name));
- var success = '[5]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "resultType: 'BOTH' test",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, "$..book[*]",{resultType:"BOTH"}));
- var success = dojo.toJson([{"path": "$['store']['book'][0]", "value": {"category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95}}, {"path": "$['store']['book'][1]", "value": {"category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", "price": 12.99}}, {"path": "$['store']['book'][2]", "value": {"category": "fiction", "author": "Herman Melville", "title": "Moby Dick", "isbn": "0-553-21311-3", "price": 8.99}}, {"path": "$['store']['book'][3]", "value": {"category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of the Rings", "isbn": "0-395-19395-8", "price": 22.99}}]);
- doh.assertEqual(success,result);
- }
- },
- {
- name: "evalType: 'RESULT' test $.store.book[?(@.price<15)][1:3]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, "$.store.book[?(@.price<15)][1:3]",{evalType:"RESULT"}));
- var success = '[{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "evalType: 'RESULT' test $.store.book[1].category",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, "$.store.book[1].category",{evalType:"RESULT"}));
- var success = '"fiction"';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "evalType: 'RESULT' test $.store.bicycle",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, "$.store.bicycle",{evalType:"RESULT"}));
- var success = '{"color":"red","price":19.95}';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "evalType: 'RESULT' test $.store.book[*]",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, "$.store.book[*]",{evalType:"RESULT"}));
- var success = '["reference","Nigel Rees","Sayings of the Century",8.95,"fiction","Evelyn Waugh","Sword of Honour",12.99,"fiction","Herman Melville","Moby Dick","0-553-21311-3",8.99,"fiction","J. R. R. Tolkien","The Lord of the Rings","0-395-19395-8",22.99]';
- doh.assertEqual(success,result);
- }
- },
- {
- name: "evalType: 'RESULT' test $.store.book.category",
- runTest: function(t) {
- var result = dojo.toJson(dojox.jsonPath.query(dojox.jsonPath.tests.testData, "$.store.book.category",{evalType:"RESULT"}));
- var success = '["reference","fiction","fiction","fiction"]';
- doh.assertEqual(success,result);
- }
- },
-
- ]
-);
-
-
-}
diff --git a/includes/js/dojox/jsonPath/tests/module.js b/includes/js/dojox/jsonPath/tests/module.js
deleted file mode 100644
index 46a5781..0000000
--- a/includes/js/dojox/jsonPath/tests/module.js
+++ /dev/null
@@ -1,12 +0,0 @@
-if(!dojo._hasResource["dojox.jsonPath.tests.module"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.jsonPath.tests.module"] = true;
-dojo.provide("dojox.jsonPath.tests.module");
-
-try{
- dojo.require("dojox.jsonPath.tests.jsonPath");
-}catch(e){
- doh.debug(e);
-}
-
-
-}
diff --git a/includes/js/dojox/jsonPath/tests/runTests.html b/includes/js/dojox/jsonPath/tests/runTests.html
deleted file mode 100644
index 60a1167..0000000
--- a/includes/js/dojox/jsonPath/tests/runTests.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
- <head>
- <title>Dojox Unit Test Runner</title>
- <meta http-equiv="REFRESH" content="0;url=../../../util/doh/runner.html?testModule=dojox.jsonPath.tests.module"></HEAD>
- <BODY>
- Redirecting to D.O.H runner.
- </BODY>
-</HTML>