tests: cleanup vlib/v/checker/tests/run ; add unused_variable_warning.vv

pull/6356/head
Delyan Angelov 2020-09-12 12:33:17 +03:00
parent e8909cced0
commit 0801f88d0a
5 changed files with 34 additions and 13 deletions

View File

@ -0,0 +1,13 @@
vlib/v/checker/tests/assign_expr_unresolved_variables_err_chain.vv:2:7: error: undefined variable `b` (used before declaration)
1 | fn main() {
2 | a := b
| ^
3 | b := c
4 | c := a
vlib/v/checker/tests/assign_expr_unresolved_variables_err_chain.vv:3:7: error: undefined variable `c` (used before declaration)
1 | fn main() {
2 | a := b
3 | b := c
| ^
4 | c := a
5 | }

View File

@ -1,13 +0,0 @@
vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.vv:2:7: error: undefined variable `b` (used before declaration)
1 | fn main() {
2 | a := b
| ^
3 | b := c
4 | c := a
vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.vv:3:7: error: undefined variable `c` (used before declaration)
1 | fn main() {
2 | a := b
3 | b := c
| ^
4 | c := a
5 | }

View File

@ -0,0 +1,15 @@
vlib/v/checker/tests/run/unused_variable_warning.vv:3:2: warning: unused variable: `a`
1 | // NB: this test should compile and run, but it also should produce a compiler warning.
2 | fn main() {
3 | a := 1
| ^
4 | b := 2
5 | println('hello')
vlib/v/checker/tests/run/unused_variable_warning.vv:4:2: warning: unused variable: `b`
2 | fn main() {
3 | a := 1
4 | b := 2
| ^
5 | println('hello')
6 | }
hello

View File

@ -0,0 +1,6 @@
// NB: this test should compile and run, but it also should produce a compiler warning.
fn main() {
a := 1
b := 2
println('hello')
}