Skip to content

Instantly share code, notes, and snippets.

@deedubs
Created January 23, 2011 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deedubs/791685 to your computer and use it in GitHub Desktop.
Save deedubs/791685 to your computer and use it in GitHub Desktop.
// division-by-zero-test.js
var vows = require('vows'),
assert = require('assert');
// Create a Test Suite
vows.describe('Division by Zero').addBatch({
'when dividing a number by zero': {
topic: function () { return 42 / 0 },
'we get Infinity': function (topic) {
assert.equal (topic, Infinity);
}
},
'but when dividing zero by zero': {
topic: function () { return 0 / 0 },
'we get a value which': {
'is not a number': function (topic) {
assert.isNaN (topic);
},
'is not equal to itself': function (topic) {
assert.notEqual (topic, topic);
}
}
}
}).run(); // Run it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment