Files
gasm-sdk/format/integration_test.go
T
petrbalvin 56ad158772
Test / vet (push) Successful in 48s
Test / test (push) Successful in 2m35s
Test / build (push) Successful in 40s
fix: restore iota blocks, asm --format flag and prose after the syntax pass
2026-08-29 17:12:53 +02:00

41 lines
1.1 KiB
Go

// 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(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)
}
}
}