mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v test-self: check unsafe_test.v, match_test.v, match_in_fn_call_test.v with -cstrict
This commit is contained in:
parent
24c59881f5
commit
d41a4ec662
@ -54,10 +54,7 @@ const (
|
||||
'do_not_remove',
|
||||
]
|
||||
skip_with_werror = [
|
||||
// -Wduplicated-branches
|
||||
'vlib/v/tests/match_in_fn_call_test.v',
|
||||
'vlib/v/tests/match_test.v',
|
||||
'vlib/v/tests/unsafe_test.v',
|
||||
'do_not_remove',
|
||||
]
|
||||
skip_with_asan_compiler = [
|
||||
'do_not_remove',
|
||||
|
@ -10,17 +10,24 @@ fn make_result() []Data {
|
||||
return []
|
||||
}
|
||||
|
||||
// make_result2 is here to ensure that
|
||||
// the branches contain different code,
|
||||
// so the tests passes even with -cstrict -cc gcc
|
||||
fn make_result2() []Data {
|
||||
return []
|
||||
}
|
||||
|
||||
fn f_doesnotcompile(d Data) []Data {
|
||||
return match d.len() {
|
||||
1 { make_result() }
|
||||
else { make_result() }
|
||||
else { make_result2() }
|
||||
}
|
||||
}
|
||||
|
||||
fn f_compiles1(d Data) []Data {
|
||||
return match d.array.len {
|
||||
1 { make_result() }
|
||||
else { make_result() }
|
||||
else { make_result2() }
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +35,7 @@ fn f_compiles2(d Data) []Data {
|
||||
length := d.array.len
|
||||
return match length {
|
||||
1 { make_result() }
|
||||
else { make_result() }
|
||||
else { make_result2() }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ fn test_method_call() {
|
||||
1 { false }
|
||||
2 { true }
|
||||
3 { false }
|
||||
else { false }
|
||||
else { true }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,8 @@ fn test_funcs() {
|
||||
|
||||
fn test_if_expr_unsafe() {
|
||||
i := 4
|
||||
p := if true { unsafe { &i } } else { unsafe { &i } }
|
||||
ii := 123
|
||||
p := if true { unsafe { &i } } else { unsafe { &ii } }
|
||||
assert *p == 4
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user