test-JSSymbol.cpp (532B)
1 #include "gdb-tests.h" 2 3 #include "js/String.h" 4 #include "js/Symbol.h" 5 6 FRAGMENT(JSSymbol, simple) { 7 using namespace JS; 8 9 RootedString hello(cx, JS_NewStringCopyZ(cx, "Hello!")); 10 11 Rooted<Symbol*> unique(cx, NewSymbol(cx, nullptr)); 12 Rooted<Symbol*> unique_with_desc(cx, NewSymbol(cx, hello)); 13 Rooted<Symbol*> registry(cx, GetSymbolFor(cx, hello)); 14 Rooted<Symbol*> well_known(cx, GetWellKnownSymbol(cx, SymbolCode::iterator)); 15 16 breakpoint(); 17 18 use(unique); 19 use(unique_with_desc); 20 use(registry); 21 use(well_known); 22 }