aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-01-05 09:33:03 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2022-01-05 09:33:03 +0100
commit93df32b34b80da4d62644004160294d1d068a934 (patch)
treeed42f20ebda9993b1ad0ebe552043be5e9bd7bc5 /tests
parent508b2487f45fac7a58549e4c5f8cde3f250ae568 (diff)
more refractoring by trying to store the variable information on the symbol.
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin42
-rw-r--r--tests/hover_test.odin42
2 files changed, 83 insertions, 1 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index 472ace0..103d5fd 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -1198,7 +1198,6 @@ ast_distinct_u32_completion :: proc(t: ^testing.T) {
source := test.Source {
main = `package main
- import "my_package"
f :: proc() {
Distinct_Type :: distinct u32
@@ -1211,6 +1210,47 @@ ast_distinct_u32_completion :: proc(t: ^testing.T) {
test.expect_completion_details(t, &source, "", {"test.d: Distinct_Type"});
}
+@(test)
+ast_new_completion :: proc(t: ^testing.T) {
+
+ source := test.Source {
+ main = `package main
+ new :: proc($T: typeid) -> (^T, Allocator_Error) #optional_second {
+ }
+
+ main :: proc() {
+ adzz := new(int);
+ adzz*
+ }
+
+ `,
+ };
+
+ test.expect_completion_details(t, &source, "", {"test.d: Distinct_Type"});
+}
+
+@(test)
+ast_rawtr_cast_completion :: proc(t: ^testing.T) {
+
+ source := test.Source {
+ main = `package main
+
+ main :: proc() {
+ raw: rawptr
+ my_int := cast(^int)raw;
+ my_i*
+ }
+
+ `,
+ };
+
+ test.expect_completion_details(t, &source, "", {"test.d: Distinct_Type"});
+}
+
+
+
+
+
/*
Looks like a bug in for each on w.*
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index d738231..ba4ffb5 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -38,4 +38,46 @@ ast_hover_default_parameter_enum :: proc(t: ^testing.T) {
};
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, "cool: my_package.My_Struct");
} \ No newline at end of file