Permalink
Browse files

simple split test from the example code

  • Loading branch information...
1 parent 1aafa50 commit d1b0779eda0a9a42dbabf71bc72e2f37bc79edeb @substack committed Jun 4, 2012
Showing with 15 additions and 1 deletion.
  1. +6 −1 package.json
  2. +9 −0 test/split.js
View
@@ -6,9 +6,14 @@
"repository": {
"url": "git://github.com/substack/node-split-by.git"
},
+ "scripts" : {
+ "test" : "tap test/*.js"
+ },
"main": "index.js",
"dependencies": {},
- "devDependencies": {},
+ "devDependencies": {
+ "tap" : "~0.2.5"
+ },
"optionalDependencies": {},
"engines": {
"node": "*"
View
@@ -0,0 +1,9 @@
+var test = require('tap').test;
+var splitBy = require('../');
+
+test('split', function (t) {
+ var xs = [ 3, 4, 0, 0, 0, 2, 1, 0, 5, 0, 0, 0, 5, 2, 1 ];
+ var res = splitBy(xs, [ 0, 0, 0 ]);
+ t.same(res, [ [ 3, 4], [ 2, 1, 0, 5 ], [ 5, 2, 1 ] ]);
+ t.end();
+});

0 comments on commit d1b0779

Please sign in to comment.