mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: merge array_map_fn_err tests (#8507)
This commit is contained in:
parent
ea06966fd4
commit
9bcb57eb1f
@ -1,6 +0,0 @@
|
||||
vlib/v/checker/tests/array_map_anon_fn_err_a.vv:2:21: error: function needs exactly 1 argument
|
||||
1 | fn main() {
|
||||
2 | a := [1,2,3,4].map(fn(a int, b int) int {return a + b})
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
3 | println(a)
|
||||
4 | }
|
@ -1,4 +0,0 @@
|
||||
fn main() {
|
||||
a := [1,2,3,4].map(fn(a int, b int) int {return a + b})
|
||||
println(a)
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
vlib/v/checker/tests/array_map_anon_fn_err_b.vv:2:21: error: type mismatch, should use `fn(a int) T {...}`
|
||||
1 | fn main() {
|
||||
2 | a := [1,2,3,4].map(fn(a string) string { return a })
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
3 | println(a)
|
||||
4 | }
|
@ -1,4 +0,0 @@
|
||||
fn main() {
|
||||
a := [1,2,3,4].map(fn(a string) string { return a })
|
||||
println(a)
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
vlib/v/checker/tests/array_map_anon_fn_err_c.vv:2:21: error: type mismatch, should use `fn(a int) T {...}`
|
||||
1 | fn main() {
|
||||
2 | a := [1,2,3,4].map(fn(a string) {})
|
||||
| ~~~~~~~~~~~~~~~
|
||||
3 | println(a)
|
||||
4 | }
|
@ -1,4 +0,0 @@
|
||||
fn main() {
|
||||
a := [1,2,3,4].map(fn(a string) {})
|
||||
println(a)
|
||||
}
|
41
vlib/v/checker/tests/array_map_fn_err.out
Normal file
41
vlib/v/checker/tests/array_map_fn_err.out
Normal file
@ -0,0 +1,41 @@
|
||||
vlib/v/checker/tests/array_map_fn_err.vv:2:22: error: function needs exactly 1 argument
|
||||
1 | fn main() {
|
||||
2 | a1 := [1,2,3,4].map(fn(a int, b int) int {return a + b})
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
3 | println(a1)
|
||||
4 |
|
||||
vlib/v/checker/tests/array_map_fn_err.vv:5:22: error: type mismatch, should use `fn(a int) T {...}`
|
||||
3 | println(a1)
|
||||
4 |
|
||||
5 | a2 := [1,2,3,4].map(fn(a string) string { return a })
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
6 | println(a2)
|
||||
7 |
|
||||
vlib/v/checker/tests/array_map_fn_err.vv:8:22: error: type mismatch, should use `fn(a int) T {...}`
|
||||
6 | println(a2)
|
||||
7 |
|
||||
8 | a3 := [1,2,3,4].map(fn(a string) {})
|
||||
| ~~~~~~~~~~~~~~~
|
||||
9 | println(a3)
|
||||
10 |
|
||||
vlib/v/checker/tests/array_map_fn_err.vv:11:18: error: function needs exactly 1 argument
|
||||
9 | println(a3)
|
||||
10 |
|
||||
11 | a4 := [1,2,3,4].map(add1)
|
||||
| ~~~~~~~~~
|
||||
12 | println(a4)
|
||||
13 |
|
||||
vlib/v/checker/tests/array_map_fn_err.vv:14:22: error: type mismatch, should use `fn(a int) T {...}`
|
||||
12 | println(a4)
|
||||
13 |
|
||||
14 | a5 := [1,2,3,4].map(add2)
|
||||
| ~~~~
|
||||
15 | println(a5)
|
||||
16 |
|
||||
vlib/v/checker/tests/array_map_fn_err.vv:17:22: error: type mismatch, should use `fn(a int) T {...}`
|
||||
15 | println(a5)
|
||||
16 |
|
||||
17 | a6 := [1,2,3,4].map(do_nothing)
|
||||
| ~~~~~~~~~~
|
||||
18 | println(a6)
|
||||
19 | }
|
30
vlib/v/checker/tests/array_map_fn_err.vv
Normal file
30
vlib/v/checker/tests/array_map_fn_err.vv
Normal file
@ -0,0 +1,30 @@
|
||||
fn main() {
|
||||
a1 := [1,2,3,4].map(fn(a int, b int) int {return a + b})
|
||||
println(a1)
|
||||
|
||||
a2 := [1,2,3,4].map(fn(a string) string { return a })
|
||||
println(a2)
|
||||
|
||||
a3 := [1,2,3,4].map(fn(a string) {})
|
||||
println(a3)
|
||||
|
||||
a4 := [1,2,3,4].map(add1)
|
||||
println(a4)
|
||||
|
||||
a5 := [1,2,3,4].map(add2)
|
||||
println(a5)
|
||||
|
||||
a6 := [1,2,3,4].map(do_nothing)
|
||||
println(a6)
|
||||
}
|
||||
|
||||
fn add1(a int, b int) int {
|
||||
return a + b
|
||||
}
|
||||
|
||||
fn add2(a string) string {
|
||||
return a
|
||||
}
|
||||
|
||||
fn do_nothing(a string) {
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
vlib/v/checker/tests/array_map_fn_err_a.vv:5:17: error: function needs exactly 1 argument
|
||||
3 | }
|
||||
4 | fn main() {
|
||||
5 | a := [1,2,3,4].map(add)
|
||||
| ~~~~~~~~
|
||||
6 | println(a)
|
||||
7 | }
|
@ -1,7 +0,0 @@
|
||||
fn add(a int, b int) int {
|
||||
return a + b
|
||||
}
|
||||
fn main() {
|
||||
a := [1,2,3,4].map(add)
|
||||
println(a)
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
vlib/v/checker/tests/array_map_fn_err_b.vv:5:21: error: type mismatch, should use `fn(a int) T {...}`
|
||||
3 | }
|
||||
4 | fn main() {
|
||||
5 | a := [1,2,3,4].map(add)
|
||||
| ~~~
|
||||
6 | println(a)
|
||||
7 | }
|
@ -1,7 +0,0 @@
|
||||
fn add(a string) string {
|
||||
return a
|
||||
}
|
||||
fn main() {
|
||||
a := [1,2,3,4].map(add)
|
||||
println(a)
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
vlib/v/checker/tests/array_map_fn_err_c.vv:3:21: error: type mismatch, should use `fn(a int) T {...}`
|
||||
1 | fn do_nothing(a string) {}
|
||||
2 | fn main() {
|
||||
3 | a := [1,2,3,4].map(do_nothing)
|
||||
| ~~~~~~~~~~
|
||||
4 | println(a)
|
||||
5 | }
|
@ -1,5 +0,0 @@
|
||||
fn do_nothing(a string) {}
|
||||
fn main() {
|
||||
a := [1,2,3,4].map(do_nothing)
|
||||
println(a)
|
||||
}
|
Loading…
Reference in New Issue
Block a user