From 20ebad86257391f3cd6dc8104fca4e169cee4695 Mon Sep 17 00:00:00 2001 From: Damian Tarnawski Date: Thu, 13 Jun 2024 11:09:41 +0200 Subject: Setup tests for semantic tokens and add one simple test --- tests/semantic_tokens_test.odin | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/semantic_tokens_test.odin (limited to 'tests') diff --git a/tests/semantic_tokens_test.odin b/tests/semantic_tokens_test.odin new file mode 100644 index 0000000..aff7788 --- /dev/null +++ b/tests/semantic_tokens_test.odin @@ -0,0 +1,36 @@ +package tests + +import "core:fmt" +import "core:testing" + +import "src:server" +import test "src:testing" + +@(test) +semantic_tokens :: proc(t: ^testing.T) { + src := test.Source { + main = +`package test +Proc_Type :: proc(a: string) -> int +my_function :: proc() { + a := 2 + b := a + c := 2 + b +} +`, + } + + test.expect_semantic_tokens(t, &src, { + {1, 0, 9, .Type, {.ReadOnly}}, // [0] Proc_Type + {0, 18, 1, .Parameter, {}}, // [1] a + {0, 3, 6, .Type, {.ReadOnly}}, // [2] string + {0, 11, 3, .Type, {.ReadOnly}}, // [3] int + {1, 0, 11, .Function, {.ReadOnly}}, // [4] my_function + {0, 0, 11, .Type, {.ReadOnly}}, // [5] !!! WRONG !!! + {1, 1, 1, .Variable, {}}, // [6] a + {1, 1, 1, .Variable, {}}, // [7] b + {0, 5, 1, .Variable, {}}, // [8] a + {1, 1, 1, .Variable, {}}, // [9] c + {0, 9, 1, .Variable, {}}, // [10] b + }) +} -- cgit v1.2.3