diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-18 01:28:05 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-18 01:28:05 -0400 |
| commit | eb5a66c944b62104537ae2762ca26911ef447f2f (patch) | |
| tree | b22e1c6427614512b6d822f3fb1cd49750fb2f12 /src/checker.cpp | |
| parent | f280ba8511b97bb1d2f5173933a6179c2aba231b (diff) | |
Forbid private test cases
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 852fb89bb..49726c090 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -4110,6 +4110,7 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) { bool is_test = false; bool is_init = false; bool is_fini = false; + bool is_priv = false; for_array(i, vd->attributes) { Ast *attr = vd->attributes[i]; @@ -4154,6 +4155,8 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) { } if (!success) { error(value, "'%.*s' expects no parameter, or a string literal containing \"file\" or \"package\"", LIT(name)); + } else { + is_priv = true; } @@ -4175,6 +4178,11 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) { } } + if (is_priv && is_test) { + error(decl, "Attribute 'private' is not allowed on a test case"); + return; + } + if (entity_visibility_kind == EntityVisiblity_Public && (c->scope->flags&ScopeFlag_File) && c->scope->file) { |