diff options
| author | gingerBill <bill@gingerbill.org> | 2021-03-14 18:43:21 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-03-14 18:43:21 +0000 |
| commit | f5142aaec41edbb85f9306216c6b199fa5adb7bb (patch) | |
| tree | bf1eb80ce88441d9bde998c9d4b879f7a7d0965c /src/checker.cpp | |
| parent | db0ac2ba984a4b395a6dfba8fcb7ab128ad96f19 (diff) | |
Change from `test_*` prefix to `@(test)` attribute for `odin test`
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index fdf9cefea..19c852621 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -1891,20 +1891,13 @@ void generate_minimum_dependency_set(Checker *c, Entity *start) { continue; } - String name = e->token.string; - String prefix = str_lit("test_"); - - if (!string_starts_with(name, prefix)) { + if ((e->flags & EntityFlag_Test) == 0) { continue; } + String name = e->token.string; - bool is_tester = false; - if (name != prefix) { - is_tester = true; - } else { - error(e->token, "Invalid testing procedure name: %.*s", LIT(name)); - } + bool is_tester = true; Type *t = base_type(e->type); GB_ASSERT(t->kind == Type_Proc); @@ -2414,7 +2407,13 @@ DECL_ATTRIBUTE_PROC(foreign_block_decl_attribute) { } DECL_ATTRIBUTE_PROC(proc_decl_attribute) { - if (name == "export") { + if (name == "test") { + if (value != nullptr) { + error(value, "'%.*s' expects no parameter, or a string literal containing \"file\" or \"package\"", LIT(name)); + } + ac->test = true; + return true; + } else if (name == "export") { ExactValue ev = check_decl_attribute_value(c, value); if (ev.kind == ExactValue_Invalid) { ac->is_export = true; |