test: gate go-libraries integration tests behind -tags=integration
Test / vet (push) Successful in 44s
Test / test (push) Successful in 2m8s
Test / build (push) Successful in 40s

Assisted-by: GLM 5.2
This commit is contained in:
2026-08-07 21:28:24 +02:00
parent 176d856f67
commit ebd8ab8a3c
10 changed files with 398 additions and 205 deletions
+40
View File
@@ -0,0 +1,40 @@
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
// SPDX-License-Identifier: BSD-3-Clause
//go:build integration
// Package format integration tests against the production go-libraries kernels.
// Excluded from the default test run so coverage is identical locally and in CI.
// Run explicitly with: go test -tags=integration ./format/
package format
import (
"os"
"path/filepath"
"strings"
"testing"
"sourcedock.dev/petrbalvin/gasm-devkit/parser"
)
// TestRoundTripRealGoLibraries checks that formatting the production kernels
// still produces source that parses cleanly.
func TestRoundTripRealGoLibraries(t *testing.T) {
real, _ := filepath.Glob("../../go-libraries/go-*/*.s")
if len(real) == 0 {
t.Skip("go-libraries repository not present")
}
for _, path := range real {
src, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
formatted := Source(path, string(src))
if _, errs := parser.Parse(path, formatted); len(errs) > 0 {
t.Errorf("formatted %s no longer parses: %v", path, errs)
}
if strings.TrimSpace(formatted) == "" {
t.Errorf("formatted %s is empty", path)
}
}
}