native test framework

This commit is contained in:
2026-07-17 22:36:17 +02:00
parent cedc63b28b
commit b09787029d
23 changed files with 141197 additions and 139688 deletions
+8
View File
@@ -1,5 +1,6 @@
package compiler
import "./ast"
import "./backend"
import "./cimport"
import "./checker"
@@ -34,6 +35,7 @@ compile_package :: proc(
selected := target.DEFAULT,
c_options := cimport.Options{},
project_root := "",
mode := ast.Compile_Mode.Executable,
) -> int {
sources := source.init_store()
defer source.destroy_store(&sources)
@@ -77,12 +79,18 @@ compile_package :: proc(
c_options,
selected,
project_root if len(project_root) > 0 else input_path,
mode,
)
if !loaded {
source.print_all(&diagnostics)
fmt.eprintln("failed to load root package directory:", input_path)
return 2
}
effective_root := project_root if len(project_root) > 0 else input_path
if !prepare_tests(&ast_module, &sources, &diagnostics, &symbols, mode, effective_root) {
source.print_all(&diagnostics)
return 1
}
// Generated C trampolines (for `static inline` imports) must be compiled and
// linked with the program. Write them out and add the source as a link input