diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2024-08-11 20:59:54 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-08-11 20:59:54 +0200 |
| commit | f0840ed24e89e6eb4ca6f87b6d8a3ca1f71a1239 (patch) | |
| tree | 875fcc98a3e6307d282478f15e0b4e07c64a30d8 /tests | |
| parent | 26fa3aca44a01f83447adb45f0f1e31fcc3d2ae6 (diff) | |
core/odin: support field tags on bit_field fields
Fixes #4044
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/core/odin/test_parser.odin | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/core/odin/test_parser.odin b/tests/core/odin/test_parser.odin index 772ae5982..b4310104f 100644 --- a/tests/core/odin/test_parser.odin +++ b/tests/core/odin/test_parser.odin @@ -1,8 +1,12 @@ package test_core_odin_parser +import "base:runtime" + +import "core:fmt" +import "core:log" import "core:odin/ast" import "core:odin/parser" -import "base:runtime" +import "core:odin/tokenizer" import "core:testing" @test @@ -34,7 +38,7 @@ Foo :: bit_field uint {} Foo :: bit_field uint {hello: bool | 1} Foo :: bit_field uint { - hello: bool | 1, + hello: bool | 1 ` + "`fmt:\"-\"`" + `, hello: bool | 5, } @@ -48,6 +52,17 @@ Foo :: bit_field uint { } p := parser.default_parser() + + p.err = proc(pos: tokenizer.Pos, format: string, args: ..any) { + message := fmt.tprintf(format, ..args) + log.errorf("%s(%d:%d): %s", pos.file, pos.line, pos.column, message) + } + + p.warn = proc(pos: tokenizer.Pos, format: string, args: ..any) { + message := fmt.tprintf(format, ..args) + log.warnf("%s(%d:%d): %s", pos.file, pos.line, pos.column, message) + } + ok := parser.parse_file(&p, &file) testing.expect(t, ok, "bad parse") -}
\ No newline at end of file +} |