From 82cdc6e7902600748ec2fae81beeb73976c070c4 Mon Sep 17 00:00:00 2001 From: Bob Remeika Date: Sat, 29 Jan 2011 02:06:05 -0800 Subject: [PATCH] Added todo tests for the most of the remaining matchers --- spec/matchers_spec.js | 36 ++++++++++++++++++++++++++++++++++++ src/matchers.js | 11 +++++++++++ 2 files changed, 47 insertions(+) diff --git a/spec/matchers_spec.js b/spec/matchers_spec.js index d66355d..d639bef 100644 --- a/spec/matchers_spec.js +++ b/spec/matchers_spec.js @@ -6,6 +6,42 @@ var footest = foounit.require(':src/foo-unit'); foounit.add(function (kw){ with(kw){ describe('foounit.matchers', function (){ + describe('.throwError', function (){ + it('asserts that an error is thrown', function (){ + throw new Error('todo'); + }); + }); + + describe('.beGt', function (){ + it('asserts expected is greater than actual', function (){ + throw new Error('todo'); + }); + }); + + describe('.beLt', function (){ + it('asserts expected is less than actual', function (){ + throw new Error('todo'); + }); + }); + + describe('.beTrue', function (){ + it('asserts that actual is === true', function (){ + throw new Error('todo'); + }); + }); + + describe('.beFalse', function (){ + it('asserts that actual is === false', function (){ + throw new Error('todo'); + }); + }); + + describe('.include', function (){ + it('asserts that the actual array has an element === to expected', function (){ + throw new Error('todo'); + }); + }); + describe('.be', function (){ it('does a strict equal', function (){ var matcher = new footest.keywords.be(); diff --git a/src/matchers.js b/src/matchers.js index d646c47..3e79f37 100644 --- a/src/matchers.js +++ b/src/matchers.js @@ -2,6 +2,17 @@ if (foounit.hostenv.type == 'node'){ var assert = require('assert'); } +/** + * Asserts that a function throws an error + */ +foounit.addKeyword('throwError', function (){ + this.match = function (expected, actual){ + // actual == block + // expected == error + assert.throws(actual, expected); + } +}); + /** * Asserts type and object */