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
+15 -4
View File
@@ -1386,9 +1386,20 @@ build_symbol_indexes :: proc(checker: ^Checker) {
}
slice.sort_by(checker.global_index, global_index_less)
checker.import_index = make([]Import_Index_Entry, len(checker.ast_module.imports), checker.allocator)
import_count := 0
for import_item in checker.ast_module.imports {
if !import_item.test_only {
import_count += 1
}
}
checker.import_index = make([]Import_Index_Entry, import_count, checker.allocator)
import_index := 0
for import_item, id in checker.ast_module.imports {
checker.import_index[id] = Import_Index_Entry{scope=import_item.file, name=import_item.alias, id=ast.import_id(id)}
if import_item.test_only {
continue
}
checker.import_index[import_index] = Import_Index_Entry{scope=import_item.file, name=import_item.alias, id=ast.import_id(id)}
import_index += 1
}
slice.sort_by(checker.import_index, import_index_less)
}
@@ -12874,7 +12885,7 @@ check :: proc(
main_template := find_template(&checker, checker.main_symbol, 0)
main_declarations := 0
for function in ast_module.functions {
if function.pkg == 0 && function.name == checker.main_symbol {
if !function.generated && function.pkg == 0 && function.name == checker.main_symbol {
main_declarations += 1
}
}
@@ -12917,7 +12928,7 @@ check :: proc(
delete(states, allocator)
propagate_problems(&checker)
for import_item in ast_module.imports {
if import_item.valid && !import_item.used {
if !import_item.test_only && import_item.valid && !import_item.used {
source.addf_warning(diagnostics, import_item.span, "unused import '%s'", symbol_text(&checker, import_item.alias))
}
}