diff options
| author | Damian Tarnawski <gthetarnav@gmail.com> | 2025-09-11 00:38:40 +0200 |
|---|---|---|
| committer | Damian Tarnawski <gthetarnav@gmail.com> | 2025-09-11 00:38:40 +0200 |
| commit | 23de8c183d052844f6b23b8ead9d03a33012af27 (patch) | |
| tree | 8ea4398b82bd8cdbe028ca1a774b3380c8e5daa9 /tests | |
| parent | 4f808a95f55a940d0dc013ca8b4fd1df427cc3da (diff) | |
Take expected inlay hints from the source code
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/inlay_hints_test.odin | 92 |
1 files changed, 18 insertions, 74 deletions
diff --git a/tests/inlay_hints_test.odin b/tests/inlay_hints_test.odin index 005253a..9d9d074 100644 --- a/tests/inlay_hints_test.odin +++ b/tests/inlay_hints_test.odin @@ -13,7 +13,7 @@ ast_inlay_hints_default_params :: proc(t: ^testing.T) { my_function :: proc(a := false, b := 42) {} main :: proc() { - my_function() + my_function([[a = false]][[, b = 42]]) } `, packages = {}, @@ -22,15 +22,7 @@ ast_inlay_hints_default_params :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {5, 15}, - kind = .Parameter, - label = "a = false", - }, { - position = {5, 15}, - kind = .Parameter, - label = ", b = 42", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -41,7 +33,7 @@ ast_inlay_hints_default_params_after_required :: proc(t: ^testing.T) { my_function :: proc(a: int, b := false, c := 42) {} main :: proc() { - my_function(1) + my_function(1[[, b = false]][[, c = 42]]) } `, packages = {}, @@ -50,15 +42,7 @@ ast_inlay_hints_default_params_after_required :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {5, 16}, - kind = .Parameter, - label = ", b = false", - }, { - position = {5, 16}, - kind = .Parameter, - label = ", c = 42", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -69,7 +53,7 @@ ast_inlay_hints_default_params_after_named :: proc(t: ^testing.T) { my_function :: proc(a: int, b := false, c := 42) {} main :: proc() { - my_function(a=1) + my_function(a=1[[, b = false]][[, c = 42]]) } `, packages = {}, @@ -79,15 +63,7 @@ ast_inlay_hints_default_params_after_named :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {5, 18}, - kind = .Parameter, - label = ", b = false", - }, { - position = {5, 18}, - kind = .Parameter, - label = ", c = 42", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -98,7 +74,7 @@ ast_inlay_hints_default_params_named_ooo :: proc(t: ^testing.T) { my_function :: proc(a: int, b := false, c := 42) {} main :: proc() { - my_function(1, c=42) + my_function(1, c=42[[, b = false]]) } `, packages = {}, @@ -107,11 +83,7 @@ ast_inlay_hints_default_params_named_ooo :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {5, 22}, - kind = .Parameter, - label = ", b = false", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -122,7 +94,7 @@ ast_inlay_hints_params :: proc(t: ^testing.T) { my_function :: proc(param1: int, param2: string) {} main :: proc() { - my_function(123, "hello") + my_function([[param1 = ]]123, [[param2 = ]]"hello") } `, packages = {}, @@ -131,15 +103,7 @@ ast_inlay_hints_params :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {5, 15}, - kind = .Parameter, - label = "param1 = ", - }, { - position = {5, 20}, - kind = .Parameter, - label = "param2 = ", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -150,7 +114,7 @@ ast_inlay_hints_mixed_params :: proc(t: ^testing.T) { my_function :: proc(required: int, optional := false) {} main :: proc() { - my_function(42) + my_function([[required = ]]42[[, optional = false]]) } `, packages = {}, @@ -160,15 +124,7 @@ ast_inlay_hints_mixed_params :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {5, 15}, - kind = .Parameter, - label = "required = ", - }, { - position = {5, 17}, - kind = .Parameter, - label = ", optional = false", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -183,7 +139,7 @@ ast_inlay_hints_selector_call :: proc(t: ^testing.T) { main :: proc() { p: Point - p->move(1.0, 2.0) + p->move([[dx = ]]1.0, [[dy = ]]2.0) } `, packages = {}, @@ -192,15 +148,7 @@ ast_inlay_hints_selector_call :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {9, 11}, - kind = .Parameter, - label = "dx = ", - }, { - position = {9, 16}, - kind = .Parameter, - label = "dy = ", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -222,7 +170,7 @@ ast_inlay_hints_no_hints_same_name :: proc(t: ^testing.T) { } // No hints should be shown when argument name matches parameter name - test.expect_inlay_hints(t, &source, {}) + test.expect_inlay_hints(t, &source) } @(test) @@ -233,7 +181,7 @@ ast_inlay_hints_variadic_params :: proc(t: ^testing.T) { variadic_func :: proc(args: ..int) {} main :: proc() { - variadic_func(1, 2, 3) + variadic_func([[args = ]]1, 2, 3) } `, packages = {}, @@ -242,11 +190,7 @@ ast_inlay_hints_variadic_params :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {{ - position = {5, 17}, - kind = .Parameter, - label = "args = ", - }}) + test.expect_inlay_hints(t, &source) } @(test) @@ -267,5 +211,5 @@ ast_inlay_hints_disabled :: proc(t: ^testing.T) { }, } - test.expect_inlay_hints(t, &source, {}) + test.expect_inlay_hints(t, &source) } |