Skip to content
This repository
Browse code

[test bin] Updates to ensure all tests are passing

  • Loading branch information...
commit 0e9c89b28dd3ed5d942d3a387f00d01fc46e64ef 1 parent 2d58999
Charlie Robbins indexzero authored
1  bin/kyuri.js → bin/kyuri 100644 → 100755
@@ -153,3 +153,4 @@ var arg, args = [], argv = process.argv.slice(2);
153 153 // and path of test folder.
154 154 var root, testFolder;
155 155
  156 +sys.puts('Kyuri test runner not currently complete in 0.2.0. In the roadmap for 0.2.1');
4 lib/kyuri/parser.js
@@ -370,8 +370,6 @@ Parser.prototype = {
370 370 this.checkTransition(token, this.current.transitions[token[0]]);
371 371 }
372 372 else {
373   - eyes.inspect(token);
374   - eyes.inspect(this.current);
375 373 throw new Error('Unexpected token "' + token[0] + '" at line ' + token[2]);
376 374 }
377 375 },
@@ -436,8 +434,6 @@ Parser.prototype = {
436 434 return true;
437 435 }
438 436
439   - eyes.inspect(this.last);
440   - eyes.inspect(this.current);
441 437 throw new Error('Mismatched last token "' + this.last[0] + '" at line ' + this.last[2]);
442 438 },
443 439
2  lib/kyuri/runners/vows.js
@@ -48,8 +48,6 @@ exports.createVows = function (filename, features) {
48 48 batch[scenario.name] = exports.scenarioVows(scenario);
49 49 });
50 50
51   - eyes.inspect(batch);
52   -
53 51 // The the batch representing the feature to the suite
54 52 suite.addBatch(batch);
55 53 });
2  lib/kyuri/steps.js
@@ -25,7 +25,7 @@ exports.When = function (pattern, topicGenerator) {
25 25
26 26 exports.Then = function (pattern, callbackGenerator) {
27 27 steps.push({
28   - operator: 'Given',
  28 + operator: 'Then',
29 29 pattern: pattern,
30 30 generator: callbackGenerator
31 31 });
30 test/lexer-test.js
@@ -28,27 +28,31 @@ var kyuri = require('kyuri'),
28 28 },
29 29 maxLength: 4096
30 30 });
31   -
32   -var readAllLines = function (filename) {
  31 +
  32 +function tokenizeAllLines (filename) {
33 33 return function () {
34   - fs.readFile(filename, encoding = 'ascii', this.callback);
35   - }
36   -};
  34 + var that = this;
  35 + fs.readFile(filename, encoding = 'ascii', function (err, data) {
  36 + if (err) return that.callback(err);
  37 + that.callback(null, kyuri.tokens(data.toString()));
  38 + });
  39 + }
  40 +}
37 41
38 42 vows.describe('kyuri/lexer').addBatch({
39 43 "When using the Kyuri lexer,": {
40 44 "lexing simple.feature": {
41   - topic: readAllLines(path.join(__dirname, '..', 'examples', 'simple.feature')),
42   - "should lex correctly": function (err, data) {
43   - assert.isNotNull(data.toString());
44   - inspect(kyuri.tokens(data.toString()));
  45 + topic: tokenizeAllLines(path.join(__dirname, '..', 'examples', 'simple.feature')),
  46 + "should lex correctly": function (err, tokens) {
  47 + assert.isNull(err);
  48 + assert.isNotNull(tokens);
45 49 }
46 50 },
47 51 "lexing complex.feature": {
48   - topic: readAllLines(path.join(__dirname, '..', 'examples', 'complex.feature')),
49   - "should lex correctly": function (err, data) {
50   - assert.isNotNull(data.toString());
51   - inspect(kyuri.tokens(data.toString()));
  52 + topic: tokenizeAllLines(path.join(__dirname, '..', 'examples', 'complex.feature')),
  53 + "should lex correctly": function (err, tokens) {
  54 + assert.isNull(err);
  55 + assert.isNotNull(tokens);
52 56 }
53 57 }
54 58 }
26 test/parser-test.js
@@ -29,26 +29,32 @@ var kyuri = require('kyuri'),
29 29 maxLength: 4096
30 30 });
31 31
32   -var readAllLines = function (filename) {
  32 +var parseAllLines = function (filename) {
33 33 return function () {
34   - fs.readFile(filename, encoding = 'ascii', this.callback);
  34 + var that = this;
  35 + fs.readFile(filename, encoding = 'ascii', function (err, data) {
  36 + if (err) return that.callback(err);
  37 + that.callback(null, kyuri.parse(data.toString()));
  38 + });
35 39 }
36 40 };
37 41
38 42 vows.describe('kyuri/parser').addBatch({
39 43 "When using the Kyuri parser,": {
40 44 "parsing simple.feature": {
41   - topic: readAllLines(path.join(__dirname, '..', 'examples', 'simple.feature')),
42   - "should parse correctly": function (err, data) {
43   - assert.isNotNull(data.toString());
44   - inspect(kyuri.parse(data.toString()));
  45 + topic: parseAllLines(path.join(__dirname, '..', 'examples', 'simple.feature')),
  46 + "should parse correctly": function (err, ast) {
  47 + assert.isNull(err);
  48 + assert.isObject(ast);
  49 + assert.include(ast, 1);
45 50 }
46 51 },
47 52 "parsing complex.feature": {
48   - topic: readAllLines(path.join(__dirname, '..', 'examples', 'complex.feature')),
49   - "should parse correctly": function (err, data) {
50   - assert.isNotNull(data.toString());
51   - inspect(kyuri.parse(data.toString()));
  53 + topic: parseAllLines(path.join(__dirname, '..', 'examples', 'complex.feature')),
  54 + "should parse correctly": function (err, ast) {
  55 + assert.isNull(err);
  56 + assert.isObject(ast);
  57 + assert.include(ast, 1);
52 58 }
53 59 }
54 60 }
4 test/simple-lexer-test.js
@@ -19,14 +19,14 @@ vows.describe('kyuri/lexer/simple').addBatch({
19 19 topic: kyuri.tokens('Feature: Addition boi'),
20 20 "should be respond with a single token literal": function (tokens) {
21 21 assert.instanceOf(tokens, Array);
22   - assert.equal(tokens.length, 1);
  22 + assert.equal(tokens.length, 4);
23 23 }
24 24 },
25 25 "a scenario token": {
26 26 topic: kyuri.tokens('Scenario: Simple math boi'),
27 27 "should be respond with a single token literal": function (tokens) {
28 28 assert.instanceOf(tokens, Array);
29   - assert.equal(tokens.length, 1);
  29 + assert.equal(tokens.length, 4);
30 30 }
31 31 }
32 32 }
6 test/vows-runner-test.js
@@ -29,7 +29,11 @@ vows.describe('kyuri/parser').addBatch({
29 29 var text = data.toString();
30 30 assert.isNotNull(text);
31 31
32   - var suite = kyuri.runners.vows.createVows('simple.feature', kyuri.parse(data.toString()).ast);
  32 + var ast = kyuri.parse(data.toString());
  33 + assert.isObject(ast);
  34 + assert.include(ast, 1);
  35 +
  36 + var suite = kyuri.runners.vows.createVows('simple.feature', ast);
33 37 assert.equal(suite.batches.length, 1);
34 38 }
35 39 }

0 comments on commit 0e9c89b

Please sign in to comment.
Something went wrong with that request. Please try again.