Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

failing test for global setup & teardown

  • Loading branch information...
commit 4352a92f2e64aefe9d13284e6654fd629f46adf8 1 parent d91045e
@brianc authored
Showing with 46 additions and 23 deletions.
  1. +46 −23 test/initial-tests.js
View
69 test/initial-tests.js
@@ -87,30 +87,53 @@ test('multiple actions', function() {
})
test('action setup', function() {
- test('not passing setup arg to following contexts', function() {
- var boom = 0;
- var bm = bench({
- repeat: 10,
- actions:[{
- name: 'boom',
- setup: function(next) {
- next(++boom)
- },
- run: function(context, next) {
- context.should.equal(1)
- next()
- },
- teardown: should.call(function(context, next) {
- context.should.equal(1)
- next()
- })
- }]
- })
- bm(should.call(function() {
- test('executes', function() {
- boom.should.equal(1)
+ var boom = 0;
+ var bm = bench({
+ repeat: 10,
+ actions:[{
+ name: 'boom',
+ setup: should.call(function(next) {
+ next(++boom)
+ }),
+ run: function(context, next) {
+ context.should.equal(1)
+ next()
+ },
+ teardown: should.call(function(context, next) {
+ context.should.equal(1)
+ next()
})
+ }]
+ })
+ bm(should.call(function() {
+ test('executes', function() {
+ boom.should.equal(1)
+ })
+ }))
+})
- }))
+test('context setup', function() {
+ var boom = 0;
+ var bm = bench({
+ name: 'whatever',
+ repeat: 1,
+ setup: should.call(function(next) {
+ next(boom++)
+ }),
+ actions: [{
+ name: 'single action with no setup',
+ run: should.call(function(context, next) {
+ context.should.equal(1)
+ next()
+ })
+ }],
+ teardown: should.call(function(context, next) {
+ context.should.equal(1)
+ next()
+ })
})
+ bm(should.call(function() {
+ boom.should.equal(1)
+ }))
})
+
Please sign in to comment.
Something went wrong with that request. Please try again.