Skip to content

Commit

Permalink
merging in michaelficarra's issue95
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Mar 20, 2011
2 parents 2545798 + 1f2c9c5 commit 866cd35
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/objects.js
Expand Up @@ -5,6 +5,9 @@ $(document).ready(function() {
test("objects: keys", function() {
var exception = /object/;
equals(_.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;
equals(_.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');
Expand Down

0 comments on commit 866cd35

Please sign in to comment.