diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-07 16:39:50 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-07 16:39:50 +0100 |
| commit | ca0bc6739213a2ef38aa79efc53b20793b00e1a1 (patch) | |
| tree | 0ccef266ef6effad14bd866052abecd4631322ad /tests | |
| parent | b37fc717c7ecc9a62e052c94a373fddde66352ad (diff) | |
More tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 34 | ||||
| -rw-r--r-- | tests/definition_test.odin | 35 |
2 files changed, 69 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 7b3d014..ef28802 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -873,6 +873,40 @@ ast_global_non_mutable_completion :: proc(t: ^testing.T) { test.expect_completion_details(t, &source, ".", {}); } +@(test) +ast_basic_value_untyped_completion :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + + main :: proc() { + xaa := 2 + xa* + } + `, + packages = {}, + }; + + test.expect_completion_details(t, &source, "", {"test.xaa: int"}); +} + +@(test) +ast_basic_value_binary_completion :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + + main :: proc() { + xaa := 2 + xb2 := xaa - 2 + xb* + } + `, + packages = {}, + }; + + test.expect_completion_details(t, &source, "", {"test.xb2: int"}); +} + + /* Looks like a bug in for each on w.* diff --git a/tests/definition_test.odin b/tests/definition_test.odin index ff9a8f5..612a2d4 100644 --- a/tests/definition_test.odin +++ b/tests/definition_test.odin @@ -3,5 +3,40 @@ package tests import "core:testing" import "core:fmt" +import "shared:common" + import test "shared:testing" +@(test) +ast_goto_untyped_value :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + + xs := 2 + + main :: proc() { + xaa := xs + + + xaa* + } + `, + packages = {}, + }; + + location := common.Location { + range = { + start = { + line = 5, + character = 10, + }, + end = { + line = 5, + character = 12, + }, + }, + uri = "file:///test/test.odin", + } + + test.expect_definition_locations(t, &source, {location}); +} |