Skip to content

Commit

Permalink
new test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Oct 19, 2023
1 parent 9486673 commit 1b76319
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions vlib/v/tests/if_assign_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct Foo {
mut:
option ?string
}

fn test_main() {
mut foo := Foo{}
some_val := 1
foo.option = if some_val > 0 {
'awesome'
} else {
none
}
assert foo.option? == 'awesome'
}

0 comments on commit 1b76319

Please sign in to comment.