| 308 | } |
| 309 | |
| 310 | static void is_array(void) |
| 311 | { |
| 312 | JSRuntime *rt = new_runtime(); |
| 313 | JSContext *ctx = JS_NewContext(rt); |
| 314 | { |
| 315 | JSValue ret = eval(ctx, "[]"); |
| 316 | assert(!JS_IsException(ret)); |
| 317 | assert(JS_IsArray(ret)); |
| 318 | JS_FreeValue(ctx, ret); |
| 319 | } |
| 320 | { |
| 321 | JSValue ret = eval(ctx, "new Proxy([], {})"); |
| 322 | assert(!JS_IsException(ret)); |
| 323 | assert(!JS_IsArray(ret)); |
| 324 | assert(JS_IsProxy(ret)); |
| 325 | JSValue handler = JS_GetProxyHandler(ctx, ret); |
| 326 | JSValue target = JS_GetProxyTarget(ctx, ret); |
| 327 | assert(!JS_IsException(handler)); |
| 328 | assert(!JS_IsException(target)); |
| 329 | assert(!JS_IsProxy(handler)); |
| 330 | assert(!JS_IsProxy(target)); |
| 331 | assert(JS_IsObject(handler)); |
| 332 | assert(JS_IsArray(target)); |
| 333 | JS_FreeValue(ctx, handler); |
| 334 | JS_FreeValue(ctx, target); |
| 335 | JS_FreeValue(ctx, ret); |
| 336 | } |
| 337 | JS_FreeContext(ctx); |
| 338 | JS_FreeRuntime(rt); |
| 339 | } |
| 340 | |
| 341 | static int loader_calls; |
| 342 |
no test coverage detected