Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[test] Add simple test and fixtures

  • Loading branch information...
commit f34eafc6e9c95475470ed4ef6b4842b1ff57d03b 1 parent 9ec16f8
@mmalecki authored
Showing with 36 additions and 0 deletions.
  1. +9 −0 test/fixtures/commit
  2. +27 −0 test/spawn-command-test.js
View
9 test/fixtures/commit
@@ -0,0 +1,9 @@
+commit 26b11915b1c16440468a4b5f4b07d2409b98c68c
+Author: Bert Belder <bertbelder@gmail.com>
+Date: Wed Jun 20 01:07:57 2012 +0200
+
+ test-domain: fix the test to work on Windows
+
+ On Windows, full pathnames are stored in the Error object when
+ a file i/o error happens. This is not the case on Unix. Before
+ this fix the test would break because of these full paths.
View
27 test/spawn-command-test.js
@@ -0,0 +1,27 @@
+var path = require('path'),
+ assert = require('assert'),
+ spawnCommand = require('../');
+
+var child = spawnCommand('grep commit < ' + path.join(__dirname, 'fixtures', 'commit')),
+ stderr = '',
+ stdout = '',
+ exited = false;
+
+child.stdout.on('data', function (chunk) {
+ stdout += chunk;
+});
+
+child.stderr.on('data', function (chunk) {
+ stderr += chunk;
+});
+
+child.on('exit', function (exitCode) {
+ exited = true;
+ assert.equal(exitCode, 0);
+ assert.equal(stdout, 'commit 26b11915b1c16440468a4b5f4b07d2409b98c68c\n');
+ assert.equal(stderr, '');
+});
+
+process.on('exit', function () {
+ assert(exited);
+});
Please sign in to comment.
Something went wrong with that request. Please try again.