Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/testing/testing.odin
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import "src:server"
Package :: struct {
pkg: string,
source: string,
// Allows you to directly specify the file path.
// If it's 'test/<file>.odin', it will share the same package as the main file.
file: string,
}

Source :: struct {
Expand Down Expand Up @@ -78,7 +81,11 @@ setup :: proc(src: ^Source) {
for src_pkg in src.packages {
context.allocator = virtual.arena_allocator(src.document.allocator)

uri := common.create_uri(fmt.aprintf("test/%v/package.odin", src_pkg.pkg), context.temp_allocator)
path := src_pkg.file
if path == "" {
path = fmt.aprintf("test/%v/package.odin", src_pkg.pkg)
}
uri := common.create_uri(path, context.temp_allocator)

fullpath := uri.path

Expand Down Expand Up @@ -162,7 +169,11 @@ expect_signature_labels :: proc(

if expected_active_parameter != -1 {
if expected_active_parameter != help.activeParameter {
log.errorf("Expected active parameter %v, but reveived %v", expected_active_parameter, help.activeParameter)
log.errorf(
"Expected active parameter %v, but reveived %v",
expected_active_parameter,
help.activeParameter,
)
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions tests/hover_test.odin
Original file line number Diff line number Diff line change
Expand Up @@ -6852,3 +6852,28 @@ ast_hover_enum_case_with_range :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.Foo: .A")
}

@(test)
ast_hover_test_with_mulitple_files :: proc(t: ^testing.T) {
packages := make([dynamic]test.Package, context.temp_allocator)

append(
&packages,
test.Package {
pkg = "test",
file = "test/test2.odin",
source = `package test
Bar :: struct{}
`,
}
)
source := test.Source {
main = `package test
main :: proc() {
bar: B{*}ar
}
`,
packages = packages[:],
}
test.expect_hover(t, &source, "test.Bar :: struct{}")
}
Loading