Add simple binary utility tests
This commit is contained in:
@@ -147,17 +147,6 @@ module.exports = function(grunt) {
|
||||
// traceur exec issues
|
||||
grunt.util.spawn({grunt: true, args: ['--stack', 'packager'], opts: {stdio: 'inherit'}}, this.async());
|
||||
});
|
||||
grunt.registerTask('test', function() {
|
||||
var done = this.async();
|
||||
|
||||
var runner = childProcess.fork('./spec/env/runner', [], {stdio: 'inherit'});
|
||||
runner.on('close', function(code) {
|
||||
if (code != 0) {
|
||||
grunt.fatal(code + ' tests failed');
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
grunt.registerTask('bench', ['metrics']);
|
||||
|
||||
grunt.registerTask('default', ['build', 'test', 'release']);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
define(['handlebars.runtime'], function(Handlebars) {
|
||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
return templates['empty'] = template(function (Handlebars,depth0,helpers,partials,data) {
|
||||
this.compilerInfo = [4,'>= 1.0.0'];
|
||||
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
var buffer = "";
|
||||
|
||||
|
||||
return buffer;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
var childProcess = require('child_process'),
|
||||
fs = require('fs');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('test:bin', function() {
|
||||
var done = this.async();
|
||||
|
||||
childProcess.exec('./bin/handlebars -a spec/artifacts/empty.handlebars', function(err, stdout) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (stdout.toString() !== fs.readFileSync('./spec/expected/empty.amd.js').toString()) {
|
||||
throw new Error('Expected binary output differed');
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
grunt.registerTask('test:mocha', function() {
|
||||
var done = this.async();
|
||||
|
||||
var runner = childProcess.fork('./spec/env/runner', [], {stdio: 'inherit'});
|
||||
runner.on('close', function(code) {
|
||||
if (code != 0) {
|
||||
grunt.fatal(code + ' tests failed');
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
grunt.registerTask('test', ['test:bin', 'test:mocha']);
|
||||
};
|
||||
Reference in New Issue
Block a user