Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Nov 18, 2023
1 parent 4e8c0c9 commit 9c17104
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions vlib/v/tests/option_sumtype_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pub type TType = []int | string

pub fn teste() ?TType {
return TType([1, 2])
}

fn test_main() {
x := teste()
if x is []int {
dump(x)
y := x as []int
assert y == [1, 2]
return
}
assert false
}

0 comments on commit 9c17104

Please sign in to comment.