Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit 99a5e1f

Browse files
committed
lots of clean up to organize tests by category, split out to different files and directories by type, define mocha.opts to run tests directory recursively. refs #3
1 parent 7ea79ae commit 99a5e1f

File tree

91 files changed

+392
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+392
-374
lines changed

Gruntfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,27 @@ module.exports = function(grunt) {
7070
options: {
7171
failOnError: true
7272
},
73-
command: './node_modules/.bin/pegjs --optimize "speed" src/grammar.pegjs lib/parser.js'
73+
command: './node_modules/.bin/pegjs --optimize speed src/grammar.pegjs lib/parser.js'
7474
},
7575
test: {
7676
options: {
7777
failOnError: true
7878
},
79-
command: './node_modules/.bin/mocha test/index-spec.js --reporter="nyan" --colors'
79+
command: './node_modules/.bin/mocha --reporter="nyan"'
8080
},
8181
debug: {
8282
options: {
8383
failOnError: false,
8484
debounceDelay: 500,
8585
forever: true
8686
},
87-
command: 'DEBUG=true ./node_modules/.bin/mocha test/index-spec.js --reporter="list" --colors'
87+
command: 'DEBUG=true ./node_modules/.bin/mocha'
8888
},
8989
json: {
9090
options: {
9191
failOnError: false
9292
},
93-
command: 'UGLY=true DEBUG=true ./node_modules/.bin/mocha test/index-spec.js --colors --reporter="list"'
93+
command: 'UGLY=true DEBUG=true ./node_modules/.bin/mocha'
9494
}
9595
},
9696
connect: {

demo/js/sqlite-parser-demo.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sqlite-parser-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sqlite-parser.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@
55
* @copyright Code School 2015 {@link http://codeschool.com}
66
* @author Nick Wronski <[email protected]>
77
*/
8-
;(function (root) {
9-
var parser = require('./lib/parser');
10-
8+
;(function (root, parser) {
119
function sqliteParser(source, callback) {
1210
try {
1311
callback(null, parser.parse(source));
1412
} catch (e) {
1513
callback(e);
1614
}
1715
}
16+
1817
sqliteParser['NAME'] = 'sqlite-parser';
1918
sqliteParser['VERSION'] = '0.10.1';
2019

2120
module.exports = root.sqliteParser = sqliteParser;
22-
})(typeof self === 'object' ? self : global);
21+
})(typeof self === 'object' ? self : global, require('./lib/parser'));
2322

2423
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2524
},{"./lib/parser":3}],2:[function(require,module,exports){

index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
* @copyright Code School 2015 {@link http://codeschool.com}
44
* @author Nick Wronski <[email protected]>
55
*/
6-
;(function (root) {
7-
var parser = require('./lib/parser');
8-
6+
;(function (root, parser) {
97
function sqliteParser(source, callback) {
108
try {
119
callback(null, parser.parse(source));
1210
} catch (e) {
1311
callback(e);
1412
}
1513
}
14+
1615
sqliteParser['NAME'] = 'sqlite-parser';
1716
sqliteParser['VERSION'] = '0.10.1';
1817

1918
module.exports = root.sqliteParser = sqliteParser;
20-
})(typeof self === 'object' ? self : global);
19+
})(typeof self === 'object' ? self : global, require('./lib/parser'));

test/core/aliases-spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
describe('aliases', function() {
2+
3+
it('basic aliases', function(done) {
4+
var resultTree = '{"statement":[{"explain":false,"type":"statement","variant":"select","from":[{"type":"identifier","variant":"table","name":"bananas","alias":"b","index":null}],"where":null,"group":null,"result":[{"type":"identifier","variant":"column","name":"apple","alias":"The Apple"},{"type":"identifier","variant":"column","name":"pear","alias":"the_pear"},{"type":"identifier","variant":"column","name":"orange","alias":"TheOrange"},{"type":"identifier","variant":"column","name":"pineapple","alias":"wherekeyword"}],"distinct":false,"all":false,"order":null,"limit":null,"with":null}]}';
5+
tree.equals(resultTree, this, done);
6+
});
7+
8+
it('uncommon aliases', function(done) {
9+
var resultTree = '{"statement":[{"explain":false,"type":"statement","variant":"select","from":[{"type":"identifier","variant":"table","name":"hats","alias":"hat","index":null}],"where":null,"group":null,"result":[{"type":"identifier","variant":"star","name":"hat.*"},{"type":"function","name":"count","distinct":false,"args":[{"type":"identifier","variant":"star","name":"*"}],"alias":"pants"}],"distinct":false,"all":false,"order":null,"limit":null,"with":null}]}';
10+
tree.equals(resultTree, this, done);
11+
});
12+
13+
});

test/core/comments-spec.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/core/create-index-spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
describe('create index', function() {
2+
3+
it('basic create index', function(done) {
4+
var resultTree = '{"statement":[{"explain":false,"type":"statement","variant":"create","format":"index","target":{"type":"identifier","variant":"index","name":"bees.hive_state"},"where":[{"type":"expression","format":"binary","variant":"operation","operation":">","left":{"type":"identifier","variant":"column","name":"anger"},"right":{"type":"literal","variant":"decimal","value":"0"}}],"on":{"target":"hive","columns":[{"type":"identifier","variant":"column","format":"indexed","direction":"asc","name":"happiness","collate":null},{"type":"identifier","variant":"column","format":"indexed","direction":"desc","name":"anger","collate":null}]},"condition":[],"unique":false}]}';
5+
tree.equals(resultTree, this, done);
6+
});
7+
8+
});

test/core/create-table-spec.js

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/core/create-trigger-spec.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)