aboutsummaryrefslogtreecommitdiff
path: root/tests/objc_test.odin
blob: c1b38bc129b186213040ce3374cf2afd1b7b4a84 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package tests

import "core:fmt"
import "core:testing"

import test "src:testing"


@(test)
cobj_return_type_with_selector_expression :: proc(t: ^testing.T) {
	packages := make([dynamic]test.Package)

	append(
		&packages,
		test.Package {
			pkg = "my_package",
			source = `package my_package    
            @(objc_class="NSWindow")
            Window :: struct { dummy: int}

            @(objc_type=Window, objc_name="alloc", objc_is_class_method=true)
            Window_alloc :: proc "c" () -> ^Window {
            }
			@(objc_type=Window, objc_name="initWithContentRect")
			Window_initWithContentRect :: proc (self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: BOOL) -> ^Window {			
			}
		`,
		},
	)

	source := test.Source {
		main     = `package test
        import "my_package"

		main :: proc() {
            window := my_package.Window.alloc()->{*}
		}
		`,
		packages = packages[:],
	}

	test.expect_completion_details(
		t,
		&source,
		"->",
		{"Window.initWithContentRect: my_package.Window_initWithContentRect"},
	)
}