aboutsummaryrefslogtreecommitdiff
path: root/tests/definition_test.odin
blob: 0f6c26f6cfd6a515b0584b8612a5b05d4feb53d8 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
package tests

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

import "shared:common"

import test "shared:testing"

@(test)
ast_goto_comp_lit_field :: proc(t: ^testing.T) {
	source := test.Source {
		main = `package test
        Point :: struct {
            x, y, z : f32,
        }
        
        main :: proc() {
            point := Point {
                x{*} = 2, y = 5, z = 0,
            }
        } 
		`,
	}

	location := common.Location {
		range = {
			start = {line = 2, character = 12},
			end = {line = 2, character = 13},
		},
	}

	test.expect_definition_locations(t, &source, {location})
}

@(test)
ast_goto_comp_lit_field_indexed :: proc(t: ^testing.T) {
	source := test.Source {
		main = `package test
        Point :: struct {
            x, y, z : f32,
        }
        
        main :: proc() {
            point := [2]Point {
                {x{*} = 2, y = 5, z = 0},
                {y = 10, y = 20, z = 10},
            }
        } 
		`,
	}

	location := common.Location {
		range = {
			start = {line = 2, character = 12},
			end = {line = 2, character = 13},
		},
	}

	test.expect_definition_locations(t, &source, {location})
}