aboutsummaryrefslogtreecommitdiff
path: root/tests/hover_test.odin
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-19 12:19:01 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-19 12:38:25 -0400
commit558f690a8d962b658986bc28fa1e5603098674c1 (patch)
treeeaa3b34ecdb5af1ccaa0f347b8482c4bf0c8f681 /tests/hover_test.odin
parent9ffbad23c023a84f568d6079e1181442f5e70500 (diff)
Correctly resolve string indexing
Diffstat (limited to 'tests/hover_test.odin')
-rw-r--r--tests/hover_test.odin39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 16bbf69..8d7f7c9 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -4261,6 +4261,45 @@ ast_hover_proc_within_for_loop :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.foo: proc()")
}
+
+@(test)
+ast_hover_string_slice_range :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ main :: proc() {
+ foo: string
+ ba{*}r := foo[1:2]
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.bar: string")
+}
+
+@(test)
+ast_hover_string_index :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ main :: proc() {
+ foo: string
+ ba{*}r := foo[1]
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.bar: u8")
+}
+
+@(test)
+ast_hover_untyped_string_index :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ main :: proc() {
+ foo := "hellope"
+ ba{*}r := foo[1]
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.bar: u8")
+}
/*
Waiting for odin fix