authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-26 15:10:13-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-26 15:10:13-04:00
logc82acdbb9ed65f3443544fe2be9bd12c9a7686d9
tree160e23068460c22c764fa3db01d1cf7d4a18eef8
parent1d95fdaf6e952674514fe5692ebd3fe1834926cb
signaturelock-open Commit is signed but in an unrecognized format.

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.

2 files changed, 11 insertions(+), 8 deletions(-)

src/analyze.cpp+10-7
...@@ -2608,7 +2608,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {...@@ -2608,7 +2608,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
2608 return ErrorNone;2608 return ErrorNone;
2609}2609}
26102610
2611static void get_fully_qualified_decl_name(Buf *buf, Tld *tld) {2611static void get_fully_qualified_decl_name(Buf *buf, Tld *tld, bool is_test) {
2612 buf_resize(buf, 0);2612 buf_resize(buf, 0);
26132613
2614 Scope *scope = tld->parent_scope;2614 Scope *scope = tld->parent_scope;
...@@ -2618,7 +2618,13 @@ static void get_fully_qualified_decl_name(Buf *buf, Tld *tld) {...@@ -2618,7 +2618,13 @@ static void get_fully_qualified_decl_name(Buf *buf, Tld *tld) {
2618 ScopeDecls *decls_scope = reinterpret_cast<ScopeDecls *>(scope);2618 ScopeDecls *decls_scope = reinterpret_cast<ScopeDecls *>(scope);
2619 buf_append_buf(buf, &decls_scope->container_type->name);2619 buf_append_buf(buf, &decls_scope->container_type->name);
2620 if (buf_len(buf) != 0) buf_append_char(buf, NAMESPACE_SEP_CHAR);2620 if (buf_len(buf) != 0) buf_append_char(buf, NAMESPACE_SEP_CHAR);
2621 buf_append_buf(buf, tld->name);2621 if (is_test) {
2622 buf_append_str(buf, "test \"");
2623 buf_append_buf(buf, tld->name);
2624 buf_append_char(buf, '"');
2625 } else {
2626 buf_append_buf(buf, tld->name);
2627 }
2622}2628}
26232629
2624ZigFn *create_fn_raw(CodeGen *g, FnInline inline_value) {2630ZigFn *create_fn_raw(CodeGen *g, FnInline inline_value) {
...@@ -2729,7 +2735,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {...@@ -2729,7 +2735,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
2729 if (fn_proto->is_export || is_extern) {2735 if (fn_proto->is_export || is_extern) {
2730 buf_init_from_buf(&fn_table_entry->symbol_name, tld_fn->base.name);2736 buf_init_from_buf(&fn_table_entry->symbol_name, tld_fn->base.name);
2731 } else {2737 } else {
2732 get_fully_qualified_decl_name(&fn_table_entry->symbol_name, &tld_fn->base);2738 get_fully_qualified_decl_name(&fn_table_entry->symbol_name, &tld_fn->base, false);
2733 }2739 }
27342740
2735 if (fn_proto->is_export) {2741 if (fn_proto->is_export) {
...@@ -2790,10 +2796,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {...@@ -2790,10 +2796,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
2790 } else if (source_node->type == NodeTypeTestDecl) {2796 } else if (source_node->type == NodeTypeTestDecl) {
2791 ZigFn *fn_table_entry = create_fn_raw(g, FnInlineAuto);2797 ZigFn *fn_table_entry = create_fn_raw(g, FnInlineAuto);
27922798
2793 Buf test_fn_name = BUF_INIT;2799 get_fully_qualified_decl_name(&fn_table_entry->symbol_name, &tld_fn->base, true);
2794 get_fully_qualified_decl_name(&test_fn_name, &tld_fn->base);
2795 buf_resize(&fn_table_entry->symbol_name, 0);
2796 buf_appendf(&fn_table_entry->symbol_name, "test \"%s\"", buf_ptr(&test_fn_name));
27972800
2798 tld_fn->fn_entry = fn_table_entry;2801 tld_fn->fn_entry = fn_table_entry;
27992802
std/special/test_runner.zig+1-1
...@@ -8,7 +8,7 @@ pub fn main() !void {...@@ -8,7 +8,7 @@ pub fn main() !void {
8 var ok_count: usize = 0;8 var ok_count: usize = 0;
9 var skip_count: usize = 0;9 var skip_count: usize = 0;
10 for (test_fn_list) |test_fn, i| {10 for (test_fn_list) |test_fn, i| {
11 warn("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name);11 warn("{}/{} {}...", i + 1, test_fn_list.len, test_fn.name);
1212
13 if (test_fn.func()) |_| {13 if (test_fn.func()) |_| {
14 ok_count += 1;14 ok_count += 1;