summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gruntfile.js11
-rw-r--r--spec/artifacts/empty.handlebars0
-rw-r--r--spec/expected/empty.amd.js11
-rw-r--r--tasks/test.js32
4 files changed, 43 insertions, 11 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index 4fe9b05..3a15813 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -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']);
diff --git a/spec/artifacts/empty.handlebars b/spec/artifacts/empty.handlebars
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/spec/artifacts/empty.handlebars
diff --git a/spec/expected/empty.amd.js b/spec/expected/empty.amd.js
new file mode 100644
index 0000000..657970c
--- /dev/null
+++ b/spec/expected/empty.amd.js
@@ -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;
+ });
+});
diff --git a/tasks/test.js b/tasks/test.js
new file mode 100644
index 0000000..cd5f00e
--- /dev/null
+++ b/tasks/test.js
@@ -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']);
+};