aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-02-22 20:46:13 +0100
committerDanielGavin <danielgavin5@hotmail.com>2024-02-22 20:46:13 +0100
commitacb232ac94f46d6c1b81378ab0be0c5b2f91a446 (patch)
tree50519c8b5f4847e73da0712c3ae801c2a184c434 /tests
parenta75c3424a6003f1ccbfbf6f170009ebf7bf18e4e (diff)
Automatically add shared collection.
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin81
-rw-r--r--tests/definition_test.odin10
-rw-r--r--tests/hover_test.odin12
-rw-r--r--tests/references_test.odin4
-rw-r--r--tests/session_test.odin6
-rw-r--r--tests/signatures_test.odin56
6 files changed, 86 insertions, 83 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index e5a9460..0330137 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -3,12 +3,12 @@ package tests
import "core:fmt"
import "core:testing"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_simple_struct_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -35,7 +35,7 @@ ast_simple_struct_completion :: proc(t: ^testing.T) {
@(test)
ast_index_array_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -62,7 +62,7 @@ ast_index_array_completion :: proc(t: ^testing.T) {
@(test)
ast_index_dynamic_array_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -89,7 +89,7 @@ ast_index_dynamic_array_completion :: proc(t: ^testing.T) {
@(test)
ast_struct_pointer_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -116,7 +116,7 @@ ast_struct_pointer_completion :: proc(t: ^testing.T) {
@(test)
ast_struct_take_address_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -144,7 +144,7 @@ ast_struct_take_address_completion :: proc(t: ^testing.T) {
@(test)
ast_struct_deref_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -172,7 +172,7 @@ ast_struct_deref_completion :: proc(t: ^testing.T) {
@(test)
ast_range_map :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -203,7 +203,7 @@ ast_range_map :: proc(t: ^testing.T) {
@(test)
ast_range_array :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -235,7 +235,7 @@ ast_range_array :: proc(t: ^testing.T) {
ast_completion_identifier_proc_group :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Int :: distinct int;
@@ -268,7 +268,7 @@ ast_completion_identifier_proc_group :: proc(t: ^testing.T) {
@(test)
ast_completion_in_comp_lit_type :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -291,7 +291,7 @@ ast_completion_in_comp_lit_type :: proc(t: ^testing.T) {
ast_completion_range_struct_selector_strings :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
array: []string,
@@ -314,7 +314,7 @@ ast_completion_range_struct_selector_strings :: proc(t: ^testing.T) {
@(test)
ast_completion_selector_on_indexed_array :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Foo :: struct {
a: int,
@@ -388,7 +388,7 @@ import "core:odin/parser"
ast_generic_make_slice :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
Allocator :: struct {
}
@@ -422,7 +422,7 @@ ast_generic_make_slice :: proc(t: ^testing.T) {
ast_named_procedure_1 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
proc_a :: proc(a: int, b: int) -> int {
}
@@ -445,7 +445,7 @@ ast_named_procedure_1 :: proc(t: ^testing.T) {
@(test)
ast_named_procedure_2 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
proc_a :: proc(a: int, b: int) -> int {
}
@@ -468,7 +468,7 @@ ast_named_procedure_2 :: proc(t: ^testing.T) {
@(test)
ast_swizzle_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4] f32;
my_array.{*}
@@ -497,7 +497,7 @@ ast_swizzle_completion :: proc(t: ^testing.T) {
@(test)
ast_swizzle_completion_one_component :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4] f32;
my_array.x{*}
@@ -517,7 +517,7 @@ ast_swizzle_completion_one_component :: proc(t: ^testing.T) {
@(test)
ast_swizzle_completion_few_components :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [2] f32;
my_array.x{*}
@@ -538,7 +538,7 @@ ast_swizzle_completion_few_components :: proc(t: ^testing.T) {
@(test)
ast_swizzle_resolve_one_components :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4]f32;
my_swizzle := my_array.x;
@@ -554,7 +554,7 @@ ast_swizzle_resolve_one_components :: proc(t: ^testing.T) {
@(test)
ast_swizzle_resolve_two_components :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4]f32;
my_swizzle := my_array.xx;
@@ -570,7 +570,7 @@ ast_swizzle_resolve_two_components :: proc(t: ^testing.T) {
@(test)
ast_swizzle_resolve_one_component_struct_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
two: int,
@@ -632,7 +632,7 @@ ast_for_in_for_from_different_package :: proc(t: ^testing.T) {
@(test)
ast_for_in_identifier_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
two: int,
@@ -664,7 +664,7 @@ ast_for_in_identifier_completion :: proc(t: ^testing.T) {
@(test)
ast_completion_poly_struct_proc :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
RenderPass :: struct(type : typeid) { list : ^int, data : type, }
LightingAccumPass2 :: struct {
@@ -684,7 +684,7 @@ ast_completion_poly_struct_proc :: proc(t: ^testing.T) {
@(test)
ast_generic_make_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
make :: proc{
make_dynamic_array,
@@ -723,7 +723,7 @@ ast_generic_make_completion :: proc(t: ^testing.T) {
@(test)
ast_generic_make_completion_2 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
make :: proc{
make_dynamic_array,
@@ -793,7 +793,7 @@ ast_struct_for_in_switch_stmt_completion :: proc(t: ^testing.T) {
@(test)
ast_overload_with_any_int_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_group :: proc{
with_any_int,
@@ -819,7 +819,7 @@ ast_overload_with_any_int_completion :: proc(t: ^testing.T) {
@(test)
ast_overload_with_any_int_with_poly_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_group :: proc{
with_any_int,
@@ -952,7 +952,7 @@ ast_package_procedure_completion :: proc(t: ^testing.T) {
@(test)
ast_poly_with_comp_lit_empty_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
a: int,
@@ -976,7 +976,7 @@ ast_poly_with_comp_lit_empty_completion :: proc(t: ^testing.T) {
@(test)
ast_global_struct_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
Foo :: struct { x: int }
foo := Foo{}
@@ -993,7 +993,7 @@ ast_global_struct_completion :: proc(t: ^testing.T) {
@(test)
ast_global_non_mutable_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
Foo :: struct { x: int }
main :: proc() {
@@ -1009,7 +1009,7 @@ ast_global_non_mutable_completion :: proc(t: ^testing.T) {
@(test)
ast_basic_value_untyped_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
main :: proc() {
xaa := 2
@@ -1025,7 +1025,7 @@ ast_basic_value_untyped_completion :: proc(t: ^testing.T) {
@(test)
ast_basic_value_binary_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
main :: proc() {
xaa := 2
@@ -1844,7 +1844,7 @@ ast_index_enum_infer_call_expr :: proc(t: ^testing.T) {
@(test)
ast_index_builtin_ODIN_OS :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
when ODIN_OS == .{*}
}
@@ -1858,7 +1858,7 @@ ast_index_builtin_ODIN_OS :: proc(t: ^testing.T) {
@(test)
ast_for_in_range_half_completion_1 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
ints: []int
@@ -1876,7 +1876,7 @@ ast_for_in_range_half_completion_1 :: proc(t: ^testing.T) {
@(test)
ast_for_in_range_half_completion_2 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
advance_rune_n :: proc(t: ^Tokenizer, n: int) {
for in 0..<n {
advance_rune(n{*})
@@ -1892,7 +1892,7 @@ ast_for_in_range_half_completion_2 :: proc(t: ^testing.T) {
@(test)
ast_for_in_switch_type :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Foo :: struct {
bar: int,
}
@@ -1924,7 +1924,7 @@ ast_for_in_switch_type :: proc(t: ^testing.T) {
@(test)
ast_procedure_in_procedure_non_mutable_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
test :: proc() {
Int :: int
@@ -1942,7 +1942,7 @@ ast_procedure_in_procedure_non_mutable_completion :: proc(t: ^testing.T) {
@(test)
ast_switch_completion_for_maybe_enum :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
Maybe :: union($T: typeid) {T}
My_Enum :: enum {
@@ -2466,7 +2466,6 @@ ast_poly_struct_with_poly :: proc(t: ^testing.T) {
packages = packages[:],
}
-
test.expect_completion_details(t, &source, "", {"test.first: ^Animal"})
}
@@ -2578,7 +2577,7 @@ ast_poly_proc_matrix_whole :: proc(t: ^testing.T) {
packages := make([dynamic]test.Package)
source := test.Source {
- main = `package test
+ main = `package test
@(require_results)
matrix_mul :: proc "contextless" (
diff --git a/tests/definition_test.odin b/tests/definition_test.odin
index 0f6c26f..6f4b982 100644
--- a/tests/definition_test.odin
+++ b/tests/definition_test.odin
@@ -1,11 +1,11 @@
package tests
-import "core:testing"
import "core:fmt"
+import "core:testing"
-import "shared:common"
+import "src:common"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_goto_comp_lit_field :: proc(t: ^testing.T) {
@@ -24,7 +24,7 @@ ast_goto_comp_lit_field :: proc(t: ^testing.T) {
}
location := common.Location {
- range = {
+ range = {
start = {line = 2, character = 12},
end = {line = 2, character = 13},
},
@@ -51,7 +51,7 @@ ast_goto_comp_lit_field_indexed :: proc(t: ^testing.T) {
}
location := common.Location {
- range = {
+ range = {
start = {line = 2, character = 12},
end = {line = 2, character = 13},
},
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 11c05de..1cee1dc 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -3,12 +3,12 @@ package tests
import "core:fmt"
import "core:testing"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_hover_default_intialized_parameter :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_function :: proc(a := false) {
b := a{*};
@@ -24,7 +24,7 @@ ast_hover_default_intialized_parameter :: proc(t: ^testing.T) {
@(test)
ast_hover_default_parameter_enum :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
procedure :: proc(called_from: Expr_Called_Type = .None, options := List_Options{}) {
}
@@ -44,7 +44,7 @@ ast_hover_default_parameter_enum :: proc(t: ^testing.T) {
@(test)
ast_hover_parameter :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc(cool: int) {
cool{*}
@@ -62,7 +62,7 @@ ast_hover_external_package_parameter :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
My_Struct :: struct {
@@ -92,7 +92,7 @@ ast_hover_procedure_package_parameter :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
My_Struct :: struct {
diff --git a/tests/references_test.odin b/tests/references_test.odin
new file mode 100644
index 0000000..25993ab
--- /dev/null
+++ b/tests/references_test.odin
@@ -0,0 +1,4 @@
+package tests
+
+import "core:fmt"
+import "core:testing"
diff --git a/tests/session_test.odin b/tests/session_test.odin
index 6991125..35f2bc6 100644
--- a/tests/session_test.odin
+++ b/tests/session_test.odin
@@ -1,14 +1,14 @@
package tests
+import "core:fmt"
import "core:log"
import "core:mem"
-import "core:fmt"
import "core:os"
import "core:strings"
import src "../src"
-import "shared:server"
+import "src:server"
initialize_request := `
{ "jsonrpc":"2.0",
@@ -333,7 +333,7 @@ main :: proc() {
buffer := TestReadBuffer {
data = transmute([]byte)strings.join(
- {
+ {
make_request(initialize_request),
make_request(shutdown_request),
make_request(exit_notification),
diff --git a/tests/signatures_test.odin b/tests/signatures_test.odin
index b6de667..66b1b01 100644
--- a/tests/signatures_test.odin
+++ b/tests/signatures_test.odin
@@ -1,15 +1,15 @@
package tests
-import "core:testing"
import "core:fmt"
+import "core:testing"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_declare_proc_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc({*})
`,
packages = {},
@@ -21,7 +21,7 @@ ast_declare_proc_signature :: proc(t: ^testing.T) {
@(test)
ast_naked_parens :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
if node == nil {
@@ -43,7 +43,7 @@ ast_naked_parens :: proc(t: ^testing.T) {
@(test)
ast_simple_proc_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int) {
}
@@ -64,7 +64,7 @@ ast_simple_proc_signature :: proc(t: ^testing.T) {
@(test)
ast_default_assignment_proc_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b := context.allocator) {
}
@@ -85,7 +85,7 @@ ast_default_assignment_proc_signature :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_last_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int) {
}
@@ -102,7 +102,7 @@ ast_proc_signature_argument_last_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_first_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int) {
}
@@ -120,7 +120,7 @@ ast_proc_signature_argument_first_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_move_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int, c: int) {
}
@@ -137,7 +137,7 @@ ast_proc_signature_argument_move_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_complex :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int, c: int) {
}
@@ -154,7 +154,7 @@ ast_proc_signature_argument_complex :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_open_brace_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int, c: int) {
}
@@ -171,7 +171,7 @@ ast_proc_signature_argument_open_brace_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_any_ellipsis_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(args: ..any, b := 2) {
}
@@ -188,7 +188,7 @@ ast_proc_signature_argument_any_ellipsis_position :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_empty_call :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
int_function :: proc(a: int) {
}
@@ -210,7 +210,7 @@ ast_proc_group_signature_empty_call :: proc(t: ^testing.T) {
test.expect_signature_labels(
t,
&source,
- {
+ {
"test.int_function: proc(a: int)",
"test.bool_function: proc(a: bool)",
},
@@ -220,7 +220,7 @@ ast_proc_group_signature_empty_call :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_generic :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:mem"
@@ -237,7 +237,7 @@ ast_proc_signature_generic :: proc(t: ^testing.T) {
test.expect_signature_labels(
t,
&source,
- {
+ {
"test.clone_array: proc(array: $A/[]^$T, allocator: mem.Allocator, unique_strings: ^map[string]string) -> A",
},
)
@@ -246,7 +246,7 @@ ast_proc_signature_generic :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_basic_types :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
int_function :: proc(a: int, b: bool, c: int) {
}
@@ -276,7 +276,7 @@ ast_proc_group_signature_basic_types :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_distinct_basic_types :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Int :: distinct int;
@@ -311,7 +311,7 @@ ast_proc_group_signature_distinct_basic_types :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_struct :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Int :: distinct int;
@@ -358,7 +358,7 @@ index_simple_signature :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
my_function :: proc(a: int, b := context.allocator) {
@@ -390,7 +390,7 @@ index_simple_signature :: proc(t: ^testing.T) {
@(test)
ast_index_builtin_len_proc :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
len({*})
}
@@ -408,7 +408,7 @@ ast_index_builtin_len_proc :: proc(t: ^testing.T) {
@(test)
ast_signature_on_invalid_package :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:totallyReal"
main :: proc() {
a := totallyReal.read_cycle_counter({*})
@@ -423,7 +423,7 @@ ast_signature_on_invalid_package :: proc(t: ^testing.T) {
@(test)
ast_signature_variable_pointer :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:totallyReal"
My_Fun :: proc(a: int) {
@@ -444,7 +444,7 @@ ast_signature_variable_pointer :: proc(t: ^testing.T) {
@(test)
ast_signature_global_variable_pointer :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:totallyReal"
My_Fun :: proc(a: int) {
@@ -468,7 +468,7 @@ index_variable_pointer_signature :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
My_Fun :: proc(a: int) {
@@ -500,7 +500,7 @@ index_variable_pointer_signature :: proc(t: ^testing.T) {
@(test)
shared_value_decl_type_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_function :: proc(a, b: int) {
@@ -523,7 +523,7 @@ shared_value_decl_type_signature :: proc(t: ^testing.T) {
@(test)
proc_with_struct_poly :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
U :: struct(N: int, E: typetid) {
t: [N]E,
}
@@ -544,7 +544,7 @@ proc_with_struct_poly :: proc(t: ^testing.T) {
@(test)
proc_signature_move_outside :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_cool_function :: proc(aa: int, ba: int, c: int) {
}