Skip to content

Commit

Permalink
Merge branch 'coffee-tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
okuryu committed Nov 30, 2014
2 parents 671ee82 + 86d117f commit aecd078
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
53 changes: 33 additions & 20 deletions tests/parser_coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,54 @@ var YUITest = require('yuitest'),
process.chdir(__dirname);

var suite = new YUITest.TestSuite({
name: 'Coffee Parser Test Suite',
name: 'CoffeeScript Parser Test Suite'
});

suite.add(new YUITest.TestCase({
name: 'CoffeeScript Parser Test 1',
setUp: function () {
var json = (new Y.YUIDoc({
quiet: true,
paths: ['input/'],
paths: ['input/coffee1'],
outdir: './out',
extension: '.coffee',
syntaxtype: 'coffee'
})).run();

this.project = json.project;
this.data = json;
},
'test: CoffeeScript Project Data 1': function () {
Assert.areSame(path.normalize('input/coffee1/test.coffee'),
this.project.file, 'Project data loaded from wrong file');
Assert.areSame(2, this.project.line, 'Line number is off');
Assert.areSame('The test project', this.project.description, 'Description not set properly');
Assert.areSame('The Tester', this.project.title, 'Title not set');
Assert.areSame('admo', this.project.author, 'Author not set');
Assert.areSame('entropy', this.project.contributor, 'Contributor not set');
Assert.areSame('http://a.img', this.project.icon[0], 'Icon not set');
Assert.areSame(1, this.project.icon.length, 'Found wring number of icons');
Assert.areSame(2, this.project.url.length, 'Found wrong number of urls');
Assert.areSame('http://one.url', this.project.url[0], 'URL #1 is wrong');
Assert.areSame('http://two.url', this.project.url[1], 'URL #2 is wrong');
}
});
}));

suite.add(new YUITest.TestCase({
name: "Project Data",
name: 'CoffeeScript Parser Test 2',
setUp: function () {
this.project = suite.project;
this.data = suite.data;
},
findByName: function (name, cl) {
var items = this.data.classitems,
ret;

items.forEach(function (i) {
if (i.name === name && i.class === cl) {
ret = i;
}
});
var json = (new Y.YUIDoc({
quiet: true,
paths: ['input/coffee2'],
outdir: './out',
extension: '.coffee',
syntaxtype: 'coffee'
})).run();

return ret;
this.project = json.project;
},
'test: project data': function () {
Assert.areSame(path.normalize('input/coffee/test.coffee'), this.project.file, 'Project data loaded from wrong file');
'test: CoffeeScript Project Data 2': function () {
Assert.areSame(path.normalize('input/coffee2/test.coffee'),
this.project.file, 'Project data loaded from wrong file');
Assert.areSame(2, this.project.line, 'Line number is off');
Assert.areSame('The test project', this.project.description, 'Description not set properly');
Assert.areSame('The Tester', this.project.title, 'Title not set');
Expand Down

0 comments on commit aecd078

Please sign in to comment.