aboutsummaryrefslogtreecommitdiff
path: root/tests/internal/test_union_switch.odin
blob: f96c0e55e13cde0789f9a9d29b46b66a3adbd791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package test_internal

import "core:log"
import "core:testing"

@(test)
test_internal_pointer_union_switch :: proc(t: ^testing.T) {
	foo: Maybe(^int)

	switch _ in foo {
	case ^int:
		log.error("incorrect case")
	case nil:
	}

	v := 1
	foo = &v

	switch _ in foo {
	case ^int:
	case nil:
		log.error("incorrect case")
	}
}