mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vfmt: fmt '!(a in/is b)' to 'a !in/is b' (#11335)
This commit is contained in:
17
vlib/v/fmt/tests/if_not_in_is_expected.vv
Normal file
17
vlib/v/fmt/tests/if_not_in_is_expected.vv
Normal file
@ -0,0 +1,17 @@
|
||||
struct Foo1 {}
|
||||
|
||||
struct Foo2 {}
|
||||
|
||||
type Foo = Foo1 | Foo2
|
||||
|
||||
fn main() {
|
||||
a := [1, 2, 3]
|
||||
if 4 !in a {
|
||||
println('4 not in a')
|
||||
}
|
||||
|
||||
foo := Foo(Foo1{})
|
||||
if foo !is Foo2 {
|
||||
println('foo is not Foo2')
|
||||
}
|
||||
}
|
17
vlib/v/fmt/tests/if_not_in_is_input.vv
Normal file
17
vlib/v/fmt/tests/if_not_in_is_input.vv
Normal file
@ -0,0 +1,17 @@
|
||||
struct Foo1{}
|
||||
|
||||
struct Foo2{}
|
||||
|
||||
type Foo = Foo1 | Foo2
|
||||
|
||||
fn main() {
|
||||
a := [1, 2, 3]
|
||||
if !(4 in a) {
|
||||
println('4 not in a')
|
||||
}
|
||||
|
||||
foo := Foo(Foo1{})
|
||||
if !(foo is Foo2) {
|
||||
println('foo is not Foo2')
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user