Added the rest of current builtins. Started properly implementing compile tests.
This commit is contained in:
42
Ink.jai
42
Ink.jai
@@ -207,17 +207,48 @@ run_codegen_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) ->
|
||||
}
|
||||
|
||||
run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Compiler_Context {
|
||||
compiler : Compiler_Context;
|
||||
ctx : Compiler_Context;
|
||||
result : Result;
|
||||
compile_file(*compiler, path);
|
||||
print("\n");
|
||||
result.path = path;
|
||||
compile_file(*ctx, path);
|
||||
|
||||
if compiler.had_error {
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
result.info_text = tprint("Failed compiling: %\n", path);
|
||||
} else {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
sb : String_Builder;
|
||||
init_string_builder(*sb,, sc.allocator);
|
||||
if ctx.vertex_entry_point.name.count > 0 {
|
||||
print_to_builder(*sb, "[vertex entry point] - %\n", ctx.vertex_entry_point.name);
|
||||
}
|
||||
if ctx.pixel_entry_point.name.count > 0 {
|
||||
print_to_builder(*sb, "[pixel entry point] - %\n", ctx.pixel_entry_point.name);
|
||||
}
|
||||
|
||||
for cb : ctx.cbuffers {
|
||||
print_to_builder(*sb, "[constant_buffer] - % - %\n", cb.name, cb.buffer_index);
|
||||
|
||||
indent(*sb, 1);
|
||||
for field : cb.fields {
|
||||
append(*sb, "[field] - ");
|
||||
pretty_print_field(*sb, *field.base_field);
|
||||
}
|
||||
}
|
||||
|
||||
result.info_text = builder_to_string(*sb,, ctx.allocator);
|
||||
}
|
||||
|
||||
return result, compiler;
|
||||
if output_type & .StdOut {
|
||||
result.type = .StdOut;
|
||||
return result, ctx;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(ctx.file.path, .Compile);
|
||||
do_golden_comparison(golden_path, result.info_text, *result, output_type);
|
||||
|
||||
return result, ctx;
|
||||
}
|
||||
|
||||
run_lexer_test :: (file_path : string, ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
@@ -376,6 +407,7 @@ run_test_new :: (file_path : string, stage_flags : Stage_Flags, results : *[..]R
|
||||
|
||||
if stage_flags & .Compile {
|
||||
result = run_compile_test(file_path, output_type);
|
||||
record_result(results, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user