This is so vibe coded, but in the interest of time, its a bit necessary. Plus this is a complex problem that I don't have the mental bandwidth to invest right now.
26 lines
549 B
Go
26 lines
549 B
Go
package syntax
|
|
|
|
import (
|
|
"testing"
|
|
|
|
sitter "github.com/tree-sitter/go-tree-sitter"
|
|
ts_go "github.com/tree-sitter/tree-sitter-go/bindings/go"
|
|
)
|
|
|
|
func TestEmbeddedGoQueryCompiles(t *testing.T) {
|
|
b, err := loadGoHighlightsQuery()
|
|
if err != nil {
|
|
t.Fatalf("failed loading embedded query: %v", err)
|
|
}
|
|
if len(b) == 0 {
|
|
t.Fatalf("embedded query is empty")
|
|
}
|
|
|
|
lang := sitter.NewLanguage(ts_go.Language())
|
|
q, qErr := sitter.NewQuery(lang, string(b))
|
|
if qErr != nil {
|
|
t.Fatalf("embedded go query failed to compile: %v", qErr)
|
|
}
|
|
q.Close()
|
|
}
|