mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: improve error message for test function definition (#15483)
This commit is contained in:
parent
f194d3ca2e
commit
0d9ac1f59c
@ -309,7 +309,7 @@ fn (mut c Checker) fn_decl(mut node ast.FnDecl) {
|
||||
if node.return_type != ast.void_type_idx
|
||||
&& node.return_type.clear_flag(.optional) != ast.void_type_idx
|
||||
&& node.return_type.clear_flag(.result) != ast.void_type_idx {
|
||||
c.error('test functions should either return nothing at all, or be marked to return `?`',
|
||||
c.error('test functions should either return nothing at all, or be marked to return `?` or `!`',
|
||||
node.pos)
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
vlib/v/checker/tests/test_functions_wrong_signature_test.vv:9:1: error: test functions should either return nothing at all, or be marked to return `?`
|
||||
7 |
|
||||
vlib/v/checker/tests/test_functions_wrong_signature_test.vv:9:1: error: test functions should either return nothing at all, or be marked to return `?` or `!`
|
||||
7 |
|
||||
8 | // should be disallowed:
|
||||
9 | fn test_returning_int() int {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
10 | }
|
||||
11 |
|
||||
vlib/v/checker/tests/test_functions_wrong_signature_test.vv:19:1: error: test functions should take 0 parameters
|
||||
17 |
|
||||
17 |
|
||||
18 | // should be disallowed:
|
||||
19 | fn test_take_parameters(v int) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
Loading…
Reference in New Issue
Block a user