Files
aego/tools/depcheck/depcheck_test.go
sanspie dae4bc19e1 Stage 1: engine core, platform, gpu, vfs
Foundation for the aego engine.

core/    errs, log, handle arena, mathx, clock, stats
platform SDL3 backend plus a headless one, input state, events
gpu      device abstraction with gl33 and null backends
vfs      scheme-based virtual filesystem with overlay mounts
engine   builder, module registry, phase-ordered system loop, jobs
demos    basic, resize, input, headless; sandbox driver

OpenGL bindings are generated into gpu/gl33/gl by tools/gen-gl.sh,
so the module has no external dependencies.
2026-09-18 20:51:54 +03:00

50 lines
1.1 KiB
Go

package main
import (
"path/filepath"
"testing"
)
func TestRepositoryRules(t *testing.T) {
violations, err := Check(filepath.Join("..", ".."))
if err != nil {
t.Fatal(err)
}
for _, v := range violations {
t.Error(v)
}
}
func TestMatch(t *testing.T) {
cases := []struct {
pattern, pkg string
want bool
}{
{"core/...", "core/mathx", true},
{"core/...", "core", true},
{"core/...", "coreutil", false},
{"platform", "platform/sdl", false},
{"platform/...", "platform/sdl", true},
{"...", "anything/at/all", true},
}
for _, c := range cases {
if got := match(c.pattern, c.pkg); got != c.want {
t.Fatalf("match(%q, %q) = %v", c.pattern, c.pkg, got)
}
}
}
func TestRuleSpecificity(t *testing.T) {
r, ok := ruleFor("platform/sdl")
if !ok || r.pkg != "platform/sdl" {
t.Fatalf("rule = %v ok=%v", r.pkg, ok)
}
r, _ = ruleFor("gpu/gl33/internal/glstate")
if r.pkg != "gpu/gl33/internal/..." {
t.Fatalf("internal rule = %v", r.pkg)
}
if _, ok := ruleFor("nowhere/at/all"); ok {
t.Fatal("unknown package matched a rule")
}
}