mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-15 02:30:11 -08:00
add test user data field for smuggling script state
This commit is contained in:
1 parent
77bacd640a
commit
b8bbd520a1
2 files changed
+16
-6
No files matched your search
+13
-6
@@ -32,16 +32,23 @@ test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name)
|
||||
return path;
|
||||
}
|
||||
|
||||
internal String8
|
||||
test_layer_from_file_path(String8 file_path)
|
||||
{
|
||||
U64 src_min = str8_find_needle(file_path, 0, s("src/"), StringMatchFlag_SlashInsensitive);
|
||||
if (src_min == file_path.size) { return str8_zero(); }
|
||||
U64 src_max = src_min + str8_lit("src/").size;
|
||||
U64 layer_slash_max = str8_find_needle(file_path, src_max, s("/"), StringMatchFlag_SlashInsensitive);
|
||||
if (layer_slash_max == file_path.size) { return str8_zero(); }
|
||||
return str8_substr(file_path, r1u64(src_max, layer_slash_max));
|
||||
}
|
||||
|
||||
internal void
|
||||
base_register_test(char *func_name_cstr, TestFunctionType *fn, char *file_path_cstr, int line, int skip)
|
||||
{
|
||||
String8 file_path = str8_cstring(file_path_cstr);
|
||||
U64 src_min = str8_find_needle(file_path, 0, s("src/"), StringMatchFlag_SlashInsensitive);
|
||||
U64 src_max = src_min + str8_lit("src/").size;
|
||||
U64 layer_slash_max = str8_find_needle(file_path, src_max, s("/"), StringMatchFlag_SlashInsensitive);
|
||||
|
||||
String8 file_path = str8_cstring(file_path_cstr);
|
||||
TestInfo *t = &test_infos[test_infos_count++];
|
||||
t->layer = str8_substr(file_path, r1u64(src_max, layer_slash_max));
|
||||
t->layer = test_layer_from_file_path(file_path);
|
||||
t->label = str8_cstring(func_name_cstr);
|
||||
t->decl_line = line;
|
||||
t->skip = skip;
|
||||
|
||||
@@ -30,6 +30,7 @@ struct TestCtx
|
||||
String8 exemplars_path;
|
||||
String8 artifacts_path;
|
||||
String8 input_data_path;
|
||||
String8 user_data;
|
||||
TestResult *result_out;
|
||||
String8List *test_out;
|
||||
};
|
||||
@@ -46,6 +47,7 @@ struct TestInfo
|
||||
S64 decl_line;
|
||||
B32 skip;
|
||||
TestFunctionType *test_fn;
|
||||
String8 user_data;
|
||||
};
|
||||
|
||||
#if BUILD_TESTS
|
||||
@@ -58,6 +60,7 @@ internal String8 test_build_exe_path(Arena *arena, String8 name);
|
||||
internal String8 test_input_path(Arena *arena, TestCtx *ctx, String8 name);
|
||||
internal String8 test_input_exe_path(Arena *arena, TestCtx *ctx, String8 name);
|
||||
internal String8 test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name);
|
||||
internal String8 test_layer_from_file_path(String8 file_path);
|
||||
internal void base_register_test(char *func_name, TestFunctionType *fn, char *file_path, int line, int skip);
|
||||
|
||||
#define AddTest(name, file_path, line, skip_, ...) \
|
||||
|
||||
Reference in new issue
Block a user