test: fix vrepl and cast test errors

pull/4924/head
yuyi 2020-05-17 08:13:08 +08:00 committed by GitHub
parent 81148fa2bd
commit 02fb393747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 51 deletions

View File

@ -72,7 +72,7 @@ fn (r &Repl) current_source_code(should_add_temp_lines bool) string {
}
fn repl_help() {
println(util.full_v_version())
println(util.full_v_version(true))
println('
help Displays this information.
list Show the program so far.
@ -83,7 +83,7 @@ fn repl_help() {
}
fn run_repl(workdir string, vrepl_prefix string) {
println(util.full_v_version())
println(util.full_v_version(true))
println('Use Ctrl-C or `exit` to exit')
file := os.join_path(workdir, '.${vrepl_prefix}vrepl.v')

View File

@ -1,56 +1,56 @@
vlib/v/checker/tests/in_mismatch_type.v:13:7: error: the data type on the left of `in` does not match the array item type
11 | }
12 | s := 'abcd'
13 | if 1 in a_s {
vlib/v/checker/tests/in_mismatch_type.v:10:7: error: the data type on the left of `in` does not match the array item type
8 | }
9 | s := 'abcd'
10 | if 1 in a_s {
| ~~
14 | println('ok')
11 | println('ok')
12 | }
vlib/v/checker/tests/in_mismatch_type.v:13:7: error: the data type on the left of `in` does not match the map key type
11 | println('ok')
12 | }
13 | if 2 in m {
| ~~
14 | println('yeah')
15 | }
vlib/v/checker/tests/in_mismatch_type.v:16:7: error: the data type on the left of `in` does not match the map key type
14 | println('ok')
vlib/v/checker/tests/in_mismatch_type.v:16:7: error: the data type on the left of `in` must be a string
14 | println('yeah')
15 | }
16 | if 2 in m {
16 | if 3 in s {
| ~~
17 | println('yeah')
17 | println('dope')
18 | }
vlib/v/checker/tests/in_mismatch_type.v:19:7: error: the data type on the left of `in` must be a string
17 | println('yeah')
vlib/v/checker/tests/in_mismatch_type.v:19:9: error: the data type on the left of `in` must be a string
17 | println('dope')
18 | }
19 | if 3 in s {
| ~~
20 | println('dope')
21 | }
vlib/v/checker/tests/in_mismatch_type.v:22:9: error: the data type on the left of `in` must be a string
20 | println('dope')
21 | }
22 | if `a` in s {
19 | if `a` in s {
| ~~
23 | println("oh no :'(")
24 | }
vlib/v/checker/tests/in_mismatch_type.v:25:7: error: `in` can only be used with an array/map/string
23 | println("oh no :'(")
24 | }
25 | if 1 in 12 {
20 | println("oh no :'(")
21 | }
vlib/v/checker/tests/in_mismatch_type.v:22:7: error: `in` can only be used with an array/map/string
20 | println("oh no :'(")
21 | }
22 | if 1 in 12 {
| ~~
26 | println('right')
27 | }
vlib/v/checker/tests/in_mismatch_type.v:28:12: error: the data type on the left of `in` does not match the map key type
26 | println('right')
27 | }
28 | if Int(2) in m {
23 | println('right')
24 | }
vlib/v/checker/tests/in_mismatch_type.v:25:12: error: the data type on the left of `in` does not match the map key type
23 | println('right')
24 | }
25 | if Int(2) in m {
| ~~
29 | println('yeah')
26 | println('yeah')
27 | }
vlib/v/checker/tests/in_mismatch_type.v:28:9: error: the data type on the left of `in` does not match the array item type
26 | println('yeah')
27 | }
28 | if '3' in a_i {
| ~~
29 | println('sure')
30 | }
vlib/v/checker/tests/in_mismatch_type.v:31:15: error: the data type on the left of `in` does not match the array item type
29 | println('yeah')
vlib/v/checker/tests/in_mismatch_type.v:31:9: error: the data type on the left of `in` does not match the array item type
29 | println('sure')
30 | }
31 | if Str2('3') in a_i {
| ~~
32 | println('sure')
31 | if '2' in a_i {
| ~~
32 | println('all right')
33 | }
vlib/v/checker/tests/in_mismatch_type.v:34:15: error: the data type on the left of `in` does not match the array item type
32 | println('sure')
33 | }
34 | if Str3('2') in a_i {
| ~~
35 | println('all right')
36 | }

View File

@ -1,8 +1,5 @@
type Int = int
type Str2 = string
type Str3 = Str2
fn main() {
a_i := [1, 2, 3]
a_s := ['1', '2', '3']
@ -28,10 +25,10 @@ fn main() {
if Int(2) in m {
println('yeah')
}
if Str2('3') in a_i {
if '3' in a_i {
println('sure')
}
if Str3('2') in a_i {
if '2' in a_i {
println('all right')
}
}

View File

@ -1,3 +1,10 @@
vlib/v/checker/tests/match_expr_else.v:4:9: error: cannot cast a string
2 |
3 | fn main() {
4 | x := A('test')
| ~~~~~~
5 | _ = match x {
6 | int {
vlib/v/checker/tests/match_expr_else.v:5:6: error: match must be exhaustive (add match branches for: `f64` or `else {}` at the end)
3 | fn main() {
4 | x := A('test')