// Copyright (c) 2026 Petr BalvĂ­n (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(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) } } }