Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

simplest working proto

  • Loading branch information...
commit d1f4adcb8bb2aa61880209f84c4b06cf6fb5e01a 1 parent 1398d1b
@brianc authored
Showing with 51 additions and 0 deletions.
  1. +9 −0 lib/index.js
  2. +20 −0 test/initial-tests.js
  3. +22 −0 test/test-helper.js
View
9 lib/index.js
@@ -0,0 +1,9 @@
+module.exports = {
+ bench: function(config) {
+ return function(callback) {
+ config.actions.forEach(function(action) {
+ action.run.call(action, callback)
+ })
+ }
+ }
+}
View
20 test/initial-tests.js
@@ -0,0 +1,20 @@
+var helper = require(__dirname + '/test-helper');
+var bencher = require(__dirname + '/../lib');
+
+test('simplest thing ever',function() {
+ var ran = false;
+ var benchmark = bencher.bench({
+ actions:[{
+ name: 'first',
+ run: function(next) {
+ ran = true;
+ next();
+ }
+ }]
+ })
+ test('execues', function() {
+ benchmark(should.call(function() {
+ ran.should.equal(true)
+ }))
+ })
+})
View
22 test/test-helper.js
@@ -0,0 +1,22 @@
+//global test function
+var should = require('should')
+var Assertion = should.Assertion;
+var assert = require('assert');
+
+Assertion.prototype.call = function(method, timeout) {
+ var called = false
+ timeout = timeout || 100;
+ var id = setTimeout(function() {
+ assert.ok(false, "Timeout wasn't called within " + timeout);
+ }, timeout)
+ return function() {
+ called = true
+ clearTimeout(id);
+ method.apply(this, arguments)
+ }
+}
+
+test = function(name, testFn) {
+ testFn()
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.