Skip to content

Commit

Permalink
Fixes jashkenas#491 - IE9 / Opera 11 test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Apr 2, 2012
1 parent 110523f commit b52908f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/objects.js
Expand Up @@ -3,16 +3,15 @@ $(document).ready(function() {
module("Objects");

test("objects: keys", function() {
var exception = /object/;
equal(_.keys({one : 1, two : 2}).join(', '), 'one, two', 'can extract the keys from an object');
// the test above is not safe because it relies on for-in enumeration order
var a = []; a[1] = 0;
equal(_.keys(a).join(', '), '1', 'is not fooled by sparse arrays; see issue #95');
raises(function() { _.keys(null); }, exception, 'throws an error for `null` values');
raises(function() { _.keys(void 0); }, exception, 'throws an error for `undefined` values');
raises(function() { _.keys(1); }, exception, 'throws an error for number primitives');
raises(function() { _.keys('a'); }, exception, 'throws an error for string primitives');
raises(function() { _.keys(true); }, exception, 'throws an error for boolean primitives');
raises(function() { _.keys(null); }, TypeError, 'throws an error for `null` values');
raises(function() { _.keys(void 0); }, TypeError, 'throws an error for `undefined` values');
raises(function() { _.keys(1); }, TypeError, 'throws an error for number primitives');
raises(function() { _.keys('a'); }, TypeError, 'throws an error for string primitives');
raises(function() { _.keys(true); }, TypeError, 'throws an error for boolean primitives');
});

test("objects: values", function() {
Expand Down

0 comments on commit b52908f

Please sign in to comment.