aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamian Tarnawski <gthetarnav@gmail.com>2024-06-13 11:09:41 +0200
committerDamian Tarnawski <gthetarnav@gmail.com>2024-06-13 11:09:41 +0200
commit20ebad86257391f3cd6dc8104fca4e169cee4695 (patch)
treee6bf2c001e670feb3561089d954cfbf978ecddec /tests
parent3c05ab67cd6b811a0993e49f2ca1ed75e0aca8e3 (diff)
Setup tests for semantic tokens and add one simple test
Diffstat (limited to 'tests')
-rw-r--r--tests/semantic_tokens_test.odin36
1 files changed, 36 insertions, 0 deletions
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
+ })
+}