|
Lines 130-135
class TestAPI {
a/Source/JavaScriptCore/API/tests/testapi.cpp_sec1
|
| 130 |
|
130 |
|
| 131 |
void basicSymbol(); |
131 |
void basicSymbol(); |
| 132 |
void symbolsTypeof(); |
132 |
void symbolsTypeof(); |
|
|
133 |
void symbolsDescription(); |
| 133 |
void symbolsGetPropertyForKey(); |
134 |
void symbolsGetPropertyForKey(); |
| 134 |
void symbolsSetPropertyForKey(); |
135 |
void symbolsSetPropertyForKey(); |
| 135 |
void symbolsHasPropertyForKey(); |
136 |
void symbolsHasPropertyForKey(); |
|
Lines 268-273
APIVector<JSValueRef> TestAPI::interestingKeys()
a/Source/JavaScriptCore/API/tests/testapi.cpp_sec2
|
| 268 |
} |
269 |
} |
| 269 |
|
270 |
|
| 270 |
static const char* isSymbolFunction = "(function isSymbol(symbol) { return typeof(symbol) === 'symbol'; })"; |
271 |
static const char* isSymbolFunction = "(function isSymbol(symbol) { return typeof(symbol) === 'symbol'; })"; |
|
|
272 |
static const char* getSymbolDescription = "(function getSymbolDescription(symbol) { return symbol.description; })"; |
| 271 |
static const char* getFunction = "(function get(object, key) { return object[key]; })"; |
273 |
static const char* getFunction = "(function get(object, key) { return object[key]; })"; |
| 272 |
static const char* setFunction = "(function set(object, key, value) { object[key] = value; })"; |
274 |
static const char* setFunction = "(function set(object, key, value) { object[key] = value; })"; |
| 273 |
|
275 |
|
|
Lines 281-289
void TestAPI::basicSymbol()
a/Source/JavaScriptCore/API/tests/testapi.cpp_sec3
|
| 281 |
|
283 |
|
| 282 |
void TestAPI::symbolsTypeof() |
284 |
void TestAPI::symbolsTypeof() |
| 283 |
{ |
285 |
{ |
| 284 |
APIString description("dope"); |
286 |
{ |
| 285 |
JSValueRef symbol = JSValueMakeSymbol(context, description); |
287 |
JSValueRef symbol = JSValueMakeSymbol(context, nullptr); |
| 286 |
check(functionReturnsTrue(isSymbolFunction, symbol), "JSValueMakeSymbol makes a symbol value"); |
288 |
check(functionReturnsTrue(isSymbolFunction, symbol), "JSValueMakeSymbol makes a symbol value"); |
|
|
289 |
} |
| 290 |
{ |
| 291 |
APIString description("dope"); |
| 292 |
JSValueRef symbol = JSValueMakeSymbol(context, description); |
| 293 |
check(functionReturnsTrue(isSymbolFunction, symbol), "JSValueMakeSymbol makes a symbol value"); |
| 294 |
} |
| 295 |
} |
| 296 |
|
| 297 |
void TestAPI::symbolsDescription() |
| 298 |
{ |
| 299 |
{ |
| 300 |
JSValueRef symbol = JSValueMakeSymbol(context, nullptr); |
| 301 |
auto result = callFunction(getSymbolDescription, symbol); |
| 302 |
check(JSValueIsStrictEqual(context, result.value(), JSValueMakeUndefined(context)), "JSValueMakeSymbol with nullptr description produces a symbol value without description"); |
| 303 |
} |
| 304 |
{ |
| 305 |
APIString description("dope"); |
| 306 |
JSValueRef symbol = JSValueMakeSymbol(context, description); |
| 307 |
auto result = callFunction(getSymbolDescription, symbol); |
| 308 |
check(JSValueIsStrictEqual(context, result.value(), JSValueMakeString(context, description)), "JSValueMakeSymbol with description string produces a symbol value with description"); |
| 309 |
} |
| 287 |
} |
310 |
} |
| 288 |
|
311 |
|
| 289 |
void TestAPI::symbolsGetPropertyForKey() |
312 |
void TestAPI::symbolsGetPropertyForKey() |
|
Lines 491-496
int testCAPIViaCpp(const char* filter)
a/Source/JavaScriptCore/API/tests/testapi.cpp_sec4
|
| 491 |
|
514 |
|
| 492 |
RUN(basicSymbol()); |
515 |
RUN(basicSymbol()); |
| 493 |
RUN(symbolsTypeof()); |
516 |
RUN(symbolsTypeof()); |
|
|
517 |
RUN(symbolsDescription()); |
| 494 |
RUN(symbolsGetPropertyForKey()); |
518 |
RUN(symbolsGetPropertyForKey()); |
| 495 |
RUN(symbolsSetPropertyForKey()); |
519 |
RUN(symbolsSetPropertyForKey()); |
| 496 |
RUN(symbolsHasPropertyForKey()); |
520 |
RUN(symbolsHasPropertyForKey()); |