Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tests for CoffeeScript #289

Merged
merged 1 commit into from
Nov 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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