diff options
| author | Andres Ornelas | 2010-07-27 15:53:55 -0700 |
|---|---|---|
| committer | Andres Ornelas | 2010-07-27 15:53:55 -0700 |
| commit | 32c4aee1cdb601550e948b52a3fa7b4824cfbf1f (patch) | |
| tree | 16bf07d3cecdcd40b6c74aeb84d9556dee027929 /src/scenario/Matcher.js | |
| parent | da95010350882d9e13b5e461fb4a1e05bc7d065c (diff) | |
| download | angular.js-32c4aee1cdb601550e948b52a3fa7b4824cfbf1f.tar.bz2 | |
before pulling testcontext out
Diffstat (limited to 'src/scenario/Matcher.js')
| -rw-r--r-- | src/scenario/Matcher.js | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/scenario/Matcher.js b/src/scenario/Matcher.js index dd7b7ee6..a4a13285 100644 --- a/src/scenario/Matcher.js +++ b/src/scenario/Matcher.js @@ -1,21 +1,21 @@ -//function Matcher(future, logger) { -// var self = this; -// this.logger = logger; -// this.future = future; -//} -// -//Matcher.addMatcher = function(name, matcher){ -// Matcher.prototype[name] = function(expected) { -// var future = this.future; -// $scenario.addFuture( -// 'expect ' + future.name + ' ' + name + ' ' + expected, -// function(done){ -// if (matcher(future.value, expected)) -// throw "Expected " + expected + ' but was ' + future.value; -// done(); -// } -// ); -// }; -//}; -// -//Matcher.addMatcher('toEqual', function(a,b){ return a == b; }); +function Matcher(future, logger) { + var self = this; + this.logger = logger; + this.future = future; +} + +Matcher.addMatcher = function(name, matcher){ + Matcher.prototype[name] = function(expected) { + var future = this.future; + $scenario.addFuture( + 'expect ' + future.name + ' ' + name + ' ' + expected, + function(done){ + if (matcher(future.value, expected)) + throw "Expected " + expected + ' but was ' + future.value; + done(); + } + ); + }; +}; + +Matcher.addMatcher('toEqual', function(a,b){ return a == b; }); |
