Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: test/mjsunit/harmony/symbols.js

Issue 13552002: ES6 symbols: fix corner cases of equality operators (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/symbols.js
diff --git a/test/mjsunit/harmony/symbols.js b/test/mjsunit/harmony/symbols.js
index 5e1515ee43cdf2cd2eb239c63648421454c34dea..c78873c294e6b4165f81c1dac20b5736ad3e8b06 100644
--- a/test/mjsunit/harmony/symbols.js
+++ b/test/mjsunit/harmony/symbols.js
@@ -131,13 +131,17 @@ TestToNumber()
function TestEquality() {
- // Every symbol should equal itself.
+ // Every symbol should equal itself, and non-strictly equal its wrapper.
for (var i in symbols) {
assertSame(symbols[i], symbols[i])
assertEquals(symbols[i], symbols[i])
assertTrue(Object.is(symbols[i], symbols[i]))
assertTrue(symbols[i] === symbols[i])
assertTrue(symbols[i] == symbols[i])
+ assertFalse(symbols[i] === new Symbol(symbols[i]))
+ assertFalse(new Symbol(symbols[i]) === symbols[i])
+ assertTrue(symbols[i] == new Symbol(symbols[i]))
+ assertTrue(new Symbol(symbols[i]) == symbols[i])
}
// All symbols should be distinct.
@@ -148,6 +152,17 @@ function TestEquality() {
assertFalse(symbols[i] == symbols[j])
}
}
+
+ // Symbols should not be equal to any other value (and the test terminates).
+ var values = [347, 1.275, NaN, "string", null, undefined, {}, function() {}]
+ for (var i in symbols) {
+ for (var j in values) {
+ assertFalse(symbols[i] === values[j])
+ assertFalse(values[j] === symbols[i])
+ assertFalse(symbols[i] == values[j])
+ assertFalse(values[j] == symbols[i])
+ }
+ }
}
TestEquality()
« no previous file with comments | « src/runtime.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698