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

Side by Side Diff: test/cctest/test-api.cc

Issue 118553003: Upgrade Symbol implementation to match current ES6 behavior. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Created 6 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 v8::Local<v8::Value> sym_val = sym2; 2752 v8::Local<v8::Value> sym_val = sym2;
2753 CHECK(sym_val->IsSymbol()); 2753 CHECK(sym_val->IsSymbol());
2754 CHECK(sym_val->Equals(sym2)); 2754 CHECK(sym_val->Equals(sym2));
2755 CHECK(sym_val->StrictEquals(sym2)); 2755 CHECK(sym_val->StrictEquals(sym2));
2756 CHECK(v8::Symbol::Cast(*sym_val)->Equals(sym2)); 2756 CHECK(v8::Symbol::Cast(*sym_val)->Equals(sym2));
2757 2757
2758 v8::Local<v8::Value> sym_obj = v8::SymbolObject::New(isolate, sym2); 2758 v8::Local<v8::Value> sym_obj = v8::SymbolObject::New(isolate, sym2);
2759 CHECK(sym_obj->IsSymbolObject()); 2759 CHECK(sym_obj->IsSymbolObject());
2760 CHECK(!sym2->IsSymbolObject()); 2760 CHECK(!sym2->IsSymbolObject());
2761 CHECK(!obj->IsSymbolObject()); 2761 CHECK(!obj->IsSymbolObject());
2762 CHECK(sym_obj->Equals(sym2)); 2762 // Comparing Symbol wrapper with Symbol will throw when
2763 // ToPrimitive() is attempted performed on the wrapper.
2764 {
2765 v8::TryCatch try_catch;
2766 sym_obj->Equals(sym2);
2767 CHECK(try_catch.HasCaught());
2768 }
2763 CHECK(!sym_obj->StrictEquals(sym2)); 2769 CHECK(!sym_obj->StrictEquals(sym2));
2764 CHECK(v8::SymbolObject::Cast(*sym_obj)->Equals(sym_obj)); 2770 CHECK(v8::SymbolObject::Cast(*sym_obj)->Equals(sym_obj));
2765 CHECK(v8::SymbolObject::Cast(*sym_obj)->ValueOf()->Equals(sym2)); 2771 CHECK(v8::SymbolObject::Cast(*sym_obj)->ValueOf()->Equals(sym2));
2766 2772
2767 // Make sure delete of a non-existent symbol property works. 2773 // Make sure delete of a non-existent symbol property works.
2768 CHECK(obj->Delete(sym1)); 2774 CHECK(obj->Delete(sym1));
2769 CHECK(!obj->Has(sym1)); 2775 CHECK(!obj->Has(sym1));
2770 2776
2771 CHECK(obj->Set(sym1, v8::Integer::New(isolate, 1503))); 2777 CHECK(obj->Set(sym1, v8::Integer::New(isolate, 1503)));
2772 CHECK(obj->Has(sym1)); 2778 CHECK(obj->Has(sym1));
(...skipping 18699 matching lines...) Expand 10 before | Expand all | Expand 10 after
21472 } 21478 }
21473 for (int i = 0; i < runs; i++) { 21479 for (int i = 0; i < runs; i++) {
21474 Local<String> expected; 21480 Local<String> expected;
21475 if (i != 0) { 21481 if (i != 0) {
21476 CHECK_EQ(v8_str("escape value"), values[i]); 21482 CHECK_EQ(v8_str("escape value"), values[i]);
21477 } else { 21483 } else {
21478 CHECK(values[i].IsEmpty()); 21484 CHECK(values[i].IsEmpty());
21479 } 21485 }
21480 } 21486 }
21481 } 21487 }
OLDNEW
« no previous file with comments | « src/symbol.js ('k') | test/mjsunit/harmony/private.js » ('j') | test/mjsunit/harmony/symbols.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698