aboutsummaryrefslogtreecommitdiff
path: root/src/stage1/analyze.cpp
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2021-01-21 09:48:57 +0100
committerLemonBoy <thatlemon@gmail.com>2021-01-21 09:48:57 +0100
commitfc5ae1c4096fa814b97671525db17c0b4f0b786d (patch)
tree6800428bfd60e844b70c5a4e77b1b34a7dc6548c /src/stage1/analyze.cpp
parentd5b0a963d1bf3399e3d8b63b03ea61f7d771adbd (diff)
downloadzig-fc5ae1c4096fa814b97671525db17c0b4f0b786d.tar.gz
zig-fc5ae1c4096fa814b97671525db17c0b4f0b786d.zip
stage1: don't filter test blocks with empty label
The common pattern of including a file containing all the tests in a empty-label test block breaks down when using --test-filter.
Diffstat (limited to 'src/stage1/analyze.cpp')
-rw-r--r--src/stage1/analyze.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp
index 5f86321e9d..a98bd28bb6 100644
--- a/src/stage1/analyze.cpp
+++ b/src/stage1/analyze.cpp
@@ -3875,7 +3875,8 @@ static void preview_test_decl(CodeGen *g, AstNode *node, ScopeDecls *decls_scope
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) {
+ if (g->test_filter != nullptr && buf_len(test_name) > 0 &&
+ strstr(buf_ptr(test_name), buf_ptr(g->test_filter)) == nullptr) {
return;
}