MCPcopy Create free account
hub / github.com/buke/quickjs-go / slice_string_tocstring

Function slice_string_tocstring

deps/quickjs/api-test.c:897–910  ·  view source on GitHub ↗

https://github.com/quickjs-ng/quickjs/issues/1178

Source from the content-addressed store, hash-verified

895
896// https://github.com/quickjs-ng/quickjs/issues/1178
897static void slice_string_tocstring(void)
898{
899 JSRuntime *rt = new_runtime();
900 JSContext *ctx = JS_NewContext(rt);
901 JSValue ret = eval(ctx, "'.'.repeat(16384).slice(1, -1)");
902 assert(!JS_IsException(ret));
903 assert(JS_IsString(ret));
904 const char *str = JS_ToCString(ctx, ret);
905 assert(strlen(str) == 16382);
906 JS_FreeCString(ctx, str);
907 JS_FreeValue(ctx, ret);
908 JS_FreeContext(ctx);
909 JS_FreeRuntime(rt);
910}
911
912static void immutable_array_buffer(void)
913{

Callers 1

mainFunction · 0.85

Calls 6

new_runtimeFunction · 0.85
evalFunction · 0.85
JS_IsExceptionFunction · 0.85
JS_IsStringFunction · 0.85
JS_ToCStringFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected