package tests import "core:testing" import "core:fmt" import test "shared:testing" @(test) ast_hover_default_intialized_parameter :: proc(t: ^testing.T) { source := test.Source { main = `package test my_function :: proc(a := false) { b := a*; } `, packages = {}, }; test.expect_hover(t, &source, "test.a: bool") } @(test) ast_hover_default_parameter_enum :: proc(t: ^testing.T) { source := test.Source { main = `package test procedure :: proc(called_from: Expr_Called_Type = .None, options := List_Options{}) { } main :: proc() { procedure* } `, packages = {}, } test.expect_hover(t, &source, "test.procedure: proc(called_from: Expr_Called_Type = .None, options := List_Options{})") } @(test) ast_hover_parameter :: proc(t: ^testing.T) { source := test.Source { main = `package test main :: proc(cool: int) { cool* } `, packages = {}, } test.expect_hover(t, &source, "cool: int") } @(test) ast_hover_external_package_parameter :: proc(t: ^testing.T) { packages := make([dynamic]test.Package); append(&packages, test.Package { pkg = "my_package", source = `package my_package My_Struct :: struct { one: int, two: int, three: int, } `, }) source := test.Source { main = `package test import "my_package" main :: proc(cool: my_package.My_Struct) { cool* } `, packages = packages[:], } test.expect_hover(t, &source, "test.cool: My_Struct") } @(test) ast_hover_procedure_package_parameter :: proc(t: ^testing.T) { packages := make([dynamic]test.Package); append(&packages, test.Package { pkg = "my_package", source = `package my_package My_Struct :: struct { one: int, two: int, three: int, } `, }) source := test.Source { main = `package test import "my_package" main :: proc(cool: my_packa*ge.My_Struct) { } `, packages = packages[:], } test.expect_hover(t, &source, "my_package: package") } @(test) ast_hover_procedure_with_default_comp_lit :: proc(t: ^testing.T) { source := test.Source { main = `package test Color :: struct { r: int, g: int, b: int, a: int, } fa* :: proc(color_ : Color = { 255, 255, 255, 255 }) `, } test.expect_hover(t, &source, "test.fa: proc(color_: Color = {255, 255, 255, 255})") } @(test) ast_hover_same_name_in_selector_and_field :: proc(t: ^testing.T) { source := test.Source { main = `package test Color :: struct { color: int, } f :: proc() { color: Color color.colo*r } `, } test.expect_hover(t, &source, "Color.color: int") }