Skip to content

Commit c2c097e

Browse files
committed
Add base for testing spread operator, we have not decided yet how to handle it.
1 parent 82dd90c commit c2c097e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

source/tests/metacall_map_test/source/metacall_map_test.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,40 @@ TEST_F(metacall_map_test, DefaultConstructor)
171171
ret = metacallfs(func, args_bad_array, sizeof(args_bad_array), allocator);
172172

173173
EXPECT_EQ((void *)NULL, (void *)ret);
174+
175+
/* TODO: Implement spread operator */
176+
/*
177+
static const char buffer[] =
178+
"function spread_parameter(...args) {\n"
179+
" console.log(args);\n"
180+
" return 'ACK: OK!';\n"
181+
"}\n"
182+
"module.exports = {\n"
183+
" spread_parameter,\n"
184+
"};\n";
185+
186+
EXPECT_EQ((int)0, (int)metacall_load_from_memory("node", buffer, sizeof(buffer), NULL));
187+
188+
static const char args_map_spread[] =
189+
"{\n"
190+
" \"id\": \"5555555-0000027\",\n"
191+
" \"loanType\": \"Retail\",\n"
192+
" \"lendingCategory\": \"Yeet\",\n"
193+
" \"comments\": {\n"
194+
" \"comment\": \"Rich-Test via Concert/Postman (Auto Approve - Attempt)\"\n"
195+
" }\n"
196+
"}\n";
197+
198+
func = metacall_function("spread_parameter");
199+
200+
ret = metacallfms(func, args_map_spread, sizeof(args_map_spread), allocator);
201+
202+
ASSERT_NE((void *)NULL, (void *)ret);
203+
204+
EXPECT_EQ((int)0, (int)strcmp(metacall_value_to_string(ret), "ACK: OK!"));
205+
206+
metacall_value_destroy(ret);
207+
*/
174208
}
175209
#endif /* OPTION_BUILD_LOADERS_NODE */
176210

0 commit comments

Comments
 (0)