MCPcopy Create free account
hub / github.com/Snapchat/Valdi / moduleInitFn

Function moduleInitFn

valdi/test/integration/TSNTestUtils.cpp:41–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41static tsn_value moduleInitFn(tsn_vm* ctx) {
42 auto* tsnModule = tsn_new_module(ctx, 1, 0, 1);
43 if (tsnModule == nullptr) {
44 return tsn_exception(ctx);
45 }
46
47 tsnModule->atoms[0] = tsn_create_atom_len(ctx, "hello", 5);
48
49 auto moduleLoadFn = tsn_new_arrow_function_closure(ctx, tsnModule, &doLoadModule, 0, 0, nullptr, 0, 0, 0);
50
51 tsn_free_module(ctx, tsnModule);
52
53 return moduleLoadFn;
54}
55
56void registerTSNTestModule(const char* moduleName) {
57 tsn_register_module_post_launch(moduleName, "", &moduleInitFn);

Callers

nothing calls this directly

Calls 5

tsn_new_moduleFunction · 0.85
tsn_exceptionFunction · 0.85
tsn_create_atom_lenFunction · 0.85
tsn_free_moduleFunction · 0.85

Tested by

no test coverage detected