using any instead of interface

This commit is contained in:
Martino Ferrari
2026-01-20 00:22:44 +01:00
parent aa47a3c4fd
commit 76bc82bf0e
5 changed files with 282 additions and 28 deletions

49
test/lsp_signal_test.go Normal file
View File

@@ -0,0 +1,49 @@
package integration
import (
"testing"
"github.com/marte-dev/marte-dev-tools/internal/index"
"github.com/marte-dev/marte-dev-tools/internal/parser"
)
func TestLSPSignalMetadata(t *testing.T) {
content := `
+MySignal = {
Class = Signal
Type = uint32
NumberOfElements = 10
NumberOfDimensions = 1
DataSource = DDB1
}
`
p := parser.NewParser(content)
config, err := p.Parse()
if err != nil {
t.Fatalf("Parse failed: %v", err)
}
idx := index.NewProjectTree()
file := "signal.marte"
idx.AddFile(file, config)
res := idx.Query(file, 2, 2) // Query +MySignal
if res == nil || res.Node == nil {
t.Fatal("Query failed for signal definition")
}
meta := res.Node.Metadata
if meta["Class"] != "Signal" {
t.Errorf("Expected Class Signal, got %s", meta["Class"])
}
if meta["Type"] != "uint32" {
t.Errorf("Expected Type uint32, got %s", meta["Type"])
}
if meta["NumberOfElements"] != "10" {
t.Errorf("Expected 10 elements, got %s", meta["NumberOfElements"])
}
// Since handleHover logic is in internal/lsp which we can't easily test directly without
// exposing formatNodeInfo, we rely on the fact that Metadata is populated correctly.
// If Metadata is correct, server.go logic (verified by code review) should display it.
}