From d12f1f5b4954d893111c05420060354537a1485c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 19 Apr 2017 15:38:12 -0400 Subject: test framework supports name prefix and filter argument rename self hosted tests to behavior tests --- src/analyze.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index af910cd590..aef85ca0b5 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1959,7 +1959,14 @@ static void preview_test_decl(CodeGen *g, AstNode *node, ScopeDecls *decls_scope if (import->package != g->root_package) return; - Buf *test_name = node->data.test_decl.name; + Buf *decl_name_buf = node->data.test_decl.name; + + Buf *test_name = g->test_name_prefix ? + buf_sprintf("%s%s", buf_ptr(g->test_name_prefix), buf_ptr(decl_name_buf)) : decl_name_buf; + + if (g->test_filter != nullptr && strstr(buf_ptr(test_name), buf_ptr(g->test_filter)) == nullptr) { + return; + } TldFn *tld_fn = allocate(1); init_tld(&tld_fn->base, TldIdFn, test_name, VisibModPrivate, node, &decls_scope->base); -- cgit v1.2.3