aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2023-01-21 23:39:23 +0100
committerDanielGavin <danielgavin5@hotmail.com>2023-01-21 23:39:23 +0100
commit532f4bf07c5830276dc4fef9ec497bf917adc8d5 (patch)
tree0c9bb33cf560a4290d6b572d1aae4528e6d85dde /tests
parent421a620e731886bb76d6831a1b617d9e7cd9e873 (diff)
Fix bug where with `for in` in `for in`
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin41
1 files changed, 38 insertions, 3 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index aef5e14..78d7f28 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -592,9 +592,46 @@ ast_swizzle_resolve_one_component_struct_completion :: proc(t: ^testing.T) {
}
@(test)
-ast_for_in_identifier_completion :: proc(t: ^testing.T) {
+ast_for_in_for_from_different_package :: proc(t: ^testing.T) {
+ packages := make([dynamic]test.Package)
+
+ append(
+ &packages,
+ test.Package{
+ pkg = "my_package",
+ source = `package my_package
+ My_Bar :: struct {
+ number: int,
+ }
+
+ My_Foo :: struct {
+ elems: []^My_Bar,
+ }
+ `,
+ },
+ )
source := test.Source {
+ main = `package test
+ import "my_package"
+ main :: proc() {
+ my_foos: []^my_package.My_Foo
+ for foo in my_foos {
+ for my_bar in foo.elems {
+ my_bar.{*}
+ }
+ }
+ }
+ `,
+ packages = packages[:],
+ }
+
+ test.expect_completion_details(t, &source, "", {"My_Bar.number: int"})
+}
+
+@(test)
+ast_for_in_identifier_completion :: proc(t: ^testing.T) {
+ source := test.Source {
main = `package test
My_Struct :: struct {
one: int,
@@ -626,7 +663,6 @@ ast_for_in_identifier_completion :: proc(t: ^testing.T) {
@(test)
ast_completion_poly_struct_proc :: proc(t: ^testing.T) {
-
source := test.Source {
main = `package test
RenderPass :: struct(type : typeid) { list : ^int, data : type, }
@@ -686,7 +722,6 @@ ast_generic_make_completion :: proc(t: ^testing.T) {
@(test)
ast_generic_make_completion_2 :: proc(t: ^testing.T) {
-
source := test.Source {
main = `package test