package packs

import (
	"strings"
	"testing"
)

func TestPackSchemaIndexHelpersStayOutOfRootVerifier(t *testing.T) {
	rootSrc := readPacksSourceForStructureTest(t, "pack_schema_verify.go")
	indexSrc := readPacksSourceForStructureTest(t, "pack_schema_verify_indices.go")

	for _, symbol := range []string{
		"const packIndexDDLMaxAttempts",
		"type packIndexInfo struct",
		"func reconcilePackTableIndices(",
		"func addPackTableIndex(",
		"func packTableIndexConverged(",
		"func removePackIndexInfoByName(",
		"func sleepPackIndexDDLRetry(",
		"func loadPhysicalIndexSet(",
		"func packIndexName(",
		"func packIndexColumnKey(",
		"func quoteIndexColumns(",
		"func isDuplicateIndexNameError(",
		"func isTransientDDLConnectionError(",
	} {
		if strings.Contains(rootSrc, symbol) {
			t.Fatalf("pack_schema_verify.go still owns schema index symbol %q", symbol)
		}
		if !strings.Contains(indexSrc, symbol) {
			t.Fatalf("pack_schema_verify_indices.go is missing schema index symbol %q", symbol)
		}
	}
}
