Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

passing test checking its own history

  • Loading branch information...
commit 803117ad9e532df4a1a1dfd75139cddd3ecbe690 1 parent 07f8c4f
@substack authored
Showing with 28 additions and 0 deletions.
  1. +3 −0  index.js
  2. +25 −0 test/history.js
View
3  index.js
@@ -36,6 +36,9 @@ exports = module.exports = function (since, until) {
else if (m = /^Date:\s+(.+)/.exec(line)) {
commit.date = new Date(m[1]);
}
+ else if (m = /^\s+(.+)/.exec(line)) {
+ commit.message = m[1];
+ }
}
function end () {
View
25 test/history.js
@@ -0,0 +1,25 @@
+var test = require('tap').test;
+var history = require('../');
+
+test('check own history', function (t) {
+ t.plan(6);
+
+ var h = history()
+ var commits = [];
+
+ h.on('data', function (commit) {
+ commits.push(commit);
+ });
+
+ h.on('end', function () {
+ var cs = commits.slice(-2);
+ t.equal(cs[0].author.name, 'James Halliday');
+ t.equal(cs[1].author.name, 'James Halliday');
+
+ t.equal(cs[0].author.email, 'mail@substack.net');
+ t.equal(cs[1].author.email, 'mail@substack.net');
+
+ t.equal(cs[0].message, 'example file and actual parsing');
+ t.equal(cs[1].message, 'some initial things');
+ });
+});
Please sign in to comment.
Something went wrong with that request. Please try again.