aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-04-26 15:10:13 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-04-26 15:10:13 -0400
commitc82acdbb9ed65f3443544fe2be9bd12c9a7686d9 (patch)
tree160e23068460c22c764fa3db01d1cf7d4a18eef8 /src/analyze.cpp
parent1d95fdaf6e952674514fe5692ebd3fe1834926cb (diff)
downloadzig-c82acdbb9ed65f3443544fe2be9bd12c9a7686d9.tar.gz
zig-c82acdbb9ed65f3443544fe2be9bd12c9a7686d9.zip
clean up test output
After 4df2f3d74f test names have the word "test" in them so the redundant word is removed from test runner. Also move the prefix/suffix to where it logically belongs in the fully qualified symbol name.
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index c0ec71a00e..aa510003b8 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -2608,7 +2608,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
return ErrorNone;
}
-static void get_fully_qualified_decl_name(Buf *buf, Tld *tld) {
+static void get_fully_qualified_decl_name(Buf *buf, Tld *tld, bool is_test) {
buf_resize(buf, 0);
Scope *scope = tld->parent_scope;
@@ -2618,7 +2618,13 @@ static void get_fully_qualified_decl_name(Buf *buf, Tld *tld) {
ScopeDecls *decls_scope = reinterpret_cast<ScopeDecls *>(scope);
buf_append_buf(buf, &decls_scope->container_type->name);
if (buf_len(buf) != 0) buf_append_char(buf, NAMESPACE_SEP_CHAR);
- buf_append_buf(buf, tld->name);
+ if (is_test) {
+ buf_append_str(buf, "test \"");
+ buf_append_buf(buf, tld->name);
+ buf_append_char(buf, '"');
+ } else {
+ buf_append_buf(buf, tld->name);
+ }
}
ZigFn *create_fn_raw(CodeGen *g, FnInline inline_value) {
@@ -2729,7 +2735,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
if (fn_proto->is_export || is_extern) {
buf_init_from_buf(&fn_table_entry->symbol_name, tld_fn->base.name);
} else {
- get_fully_qualified_decl_name(&fn_table_entry->symbol_name, &tld_fn->base);
+ get_fully_qualified_decl_name(&fn_table_entry->symbol_name, &tld_fn->base, false);
}
if (fn_proto->is_export) {
@@ -2790,10 +2796,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
} else if (source_node->type == NodeTypeTestDecl) {
ZigFn *fn_table_entry = create_fn_raw(g, FnInlineAuto);
- Buf test_fn_name = BUF_INIT;
- get_fully_qualified_decl_name(&test_fn_name, &tld_fn->base);
- buf_resize(&fn_table_entry->symbol_name, 0);
- buf_appendf(&fn_table_entry->symbol_name, "test \"%s\"", buf_ptr(&test_fn_name));
+ get_fully_qualified_decl_name(&fn_table_entry->symbol_name, &tld_fn->base, true);
tld_fn->fn_entry = fn_table_entry;