1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v.parser: do not treat test_ functions specially outside of _test.v files

This commit is contained in:
Delyan Angelov 2021-06-08 23:01:49 +03:00
parent 000790b112
commit 3dc4d13160
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -341,7 +341,8 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
end_pos := p.prev_tok.position() end_pos := p.prev_tok.position()
short_fn_name := name short_fn_name := name
is_main := short_fn_name == 'main' && p.mod == 'main' is_main := short_fn_name == 'main' && p.mod == 'main'
is_test := short_fn_name.starts_with('test_') || short_fn_name.starts_with('testsuite_') mut is_test := (short_fn_name.starts_with('test_') || short_fn_name.starts_with('testsuite_'))
&& (p.file_base.ends_with('_test.v') || p.file_base.ends_with('_test.vv'))
// Register // Register
if is_method { if is_method {