diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-03 21:20:29 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-04 20:39:31 -0400 |
| commit | d91f1da376e12f7ea8eef54528dc6f5ace6cf8bb (patch) | |
| tree | 94314490b8abe972f369217b6e5991c558dcee25 /tests | |
| parent | c7c76658be61af1532c0320dc0029e5b39f1c6fd (diff) | |
Enrich bit field hover documentation
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hover_test.odin | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 20e9643..31fb2d9 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -1992,6 +1992,49 @@ ast_hover_enum_defintion_with_base_type :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.Foo: enum u8 {\n\tA = 1,\n\tBar = 2,\n\tC = 3,\n}") } + +@(test) +ast_hover_bit_field :: proc(t: ^testing.T) { + source :=test.Source { + main = `package test + F{*}oo :: bit_field u8 { + foo_a: uint | 2, + foo_aa: uint | 4, + } + ` + } + test.expect_hover(t, &source, "test.Foo: bit_field u8 {\n\tfoo_a: uint | 2,\n\tfoo_aa: uint | 4,\n}") +} + +@(test) +ast_hover_bit_field_array_backed :: proc(t: ^testing.T) { + source :=test.Source { + main = `package test + F{*}oo :: bit_field [4]u8 { + foo_a: uint | 1, + foo_aa: uint | 3, + } + ` + } + test.expect_hover(t, &source, "test.Foo: bit_field [4]u8 {\n\tfoo_a: uint | 1,\n\tfoo_aa: uint | 3,\n}") +} + +@(test) +ast_hover_bit_field_with_docs :: proc(t: ^testing.T) { + source :=test.Source { + main = `package test + F{*}oo :: bit_field u8 { + // documentation + foo_a: uintptr | 2, + foo_bbbb: uint | 4, // comment for b + // doc + foo_c: uint | 2, //comment + } + ` + } + test.expect_hover(t, &source, "test.Foo: bit_field u8 {\n\t// documentation\n\tfoo_a: uintptr | 2,\n\tfoo_bbbb: uint | 4, // comment for b\n\t// doc\n\tfoo_c: uint | 2, //comment\n}") +} + /* Waiting for odin fix |