forked from jasmine/jasmine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for jasmine.any(Symbol).
The original asymmetric matcher code for Any did not work with symbols since `symbolInstance instanceof Symbol` is actually `false` (but, `symbolInstance.constructor` is `Symbol). This simply adds an extra clause that explicitly checks for symbol (if available) like the other primitive types. Also added some missing specs for other types, like Map, Set, etc. Fixes jasmine#1431.
- Loading branch information
Showing
5 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(function(env) { | ||
function hasFunctioningSymbols() { | ||
if (typeof Symbol === 'undefined') { | ||
return false; | ||
} | ||
|
||
try { | ||
var s1 = Symbol(); | ||
var s2 = Symbol(); | ||
if (typeof s1 !== 'symbol') { | ||
return false; | ||
} | ||
if (s1 === s2) { | ||
return false; | ||
} | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
env.requireFunctioningSymbols = function() { | ||
if (!hasFunctioningSymbols()) { | ||
env.pending("Browser has incomplete or missing support for Symbols"); | ||
} | ||
}; | ||
|
||
})(jasmine.getEnv()); |
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
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
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