Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Prefer equal(x, y) over ok(x == y) #519

Merged
merged 1 commit into from

3 participants

@mark-rushakoff

If/when these tests fail, the failure message for equal gives more useful information than the failure message for ok.

@michaelficarra
Collaborator

+1e9

@braddunbar braddunbar merged commit c46cd35 into jashkenas:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 23, 2012
  1. @mark-rushakoff
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 5 deletions.
  1. +5 −5 test/functions.js
View
10 test/functions.js
@@ -101,8 +101,8 @@ $(document).ready(function() {
setTimeout(throttledIncr, 190);
setTimeout(throttledIncr, 220);
setTimeout(throttledIncr, 240);
- _.delay(function(){ ok(counter == 1, "incr was called immediately"); }, 30);
- _.delay(function(){ ok(counter == 4, "incr was throttled"); start(); }, 400);
+ _.delay(function(){ equal(counter, 1, "incr was called immediately"); }, 30);
+ _.delay(function(){ equal(counter, 4, "incr was throttled"); start(); }, 400);
});
asyncTest("functions: throttle arguments", 2, function() {
@@ -122,7 +122,7 @@ $(document).ready(function() {
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100);
throttledIncr();
- _.delay(function(){ ok(counter == 1, "incr was called once"); start(); }, 220);
+ _.delay(function(){ equal(counter, 1, "incr was called once"); start(); }, 220);
});
asyncTest("functions: throttle twice", 1, function() {
@@ -130,7 +130,7 @@ $(document).ready(function() {
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100);
throttledIncr(); throttledIncr();
- _.delay(function(){ ok(counter == 2, "incr was called twice"); start(); }, 220);
+ _.delay(function(){ equal(counter, 2, "incr was called twice"); start(); }, 220);
});
asyncTest("functions: debounce", 1, function() {
@@ -143,7 +143,7 @@ $(document).ready(function() {
setTimeout(debouncedIncr, 90);
setTimeout(debouncedIncr, 120);
setTimeout(debouncedIncr, 150);
- _.delay(function(){ ok(counter == 1, "incr was debounced"); start(); }, 220);
+ _.delay(function(){ equal(counter, 1, "incr was debounced"); start(); }, 220);
});
asyncTest("functions: debounce asap", 2, function() {
Something went wrong with that request. Please try again.