Created
September 12, 2011 18:55
-
-
Save mich-cook/1212065 to your computer and use it in GitHub Desktop.
A test that loops over values doesn't work if it's the first one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Testing some characters', function() { | |
var chars = ['&', '\'', '"', '<', '>']; | |
for(var i = 0; i < chars.length; i+=1) { | |
currentChar = chars[i]; | |
it('should reject ' + currentChar, (function(currentChar) { | |
expect(false).toEqual(false); | |
})(currentChar)); | |
} | |
}); | |
/* | |
jasmine$ ./runspecs.js | |
node.js:205 | |
throw e; // process.nextTick error, or 'error' event on first tick | |
^ | |
Error: jasmine.Suite() required | |
at new <anonymous> (jasmine/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.0.1.js:1856:11) | |
at [object Object].it (jasmine/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.0.1.js:803:14) | |
at [object Object].describe (jasmine/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.0.1.js:766:10) | |
at jasmine/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.0.1.js:556:27 | |
at jasmine/specs/test.spec.js:46:5 | |
at Object.<anonymous> (jasmine/specs/test.spec.js:202:2) | |
at Module._compile (module.js:416:26) | |
at Object..js (module.js:434:10) | |
at Module.load (module.js:335:31) | |
at Function._load (module.js:294:12) | |
jasmine$ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('test1', function() { | |
it('should pass this test', function() { | |
expect(true).toEqual(true); | |
}); | |
}); | |
describe('Testing some characters', function() { | |
var chars = ['&', '\'', '"', '<', '>']; | |
for(var i = 0; i < chars.length; i+=1) { | |
currentChar = chars[i]; | |
it('should reject ' + currentChar, (function(currentChar) { | |
expect(false).toEqual(false); | |
})(currentChar)); | |
} | |
}); | |
/* | |
jasmine$ ./runspecs.js | |
Started | |
...... | |
Spec test1 | |
it should pass this test | |
Spec Testing some characters | |
it should reject & | |
it should reject ' | |
it should reject " | |
it should reject < | |
it should reject > | |
Finished in 0.002 seconds | |
2 tests, 6 assertions, 0 failures | |
jasmine$ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment