mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
The repositories moved from Neo-Desktop to the D-Modem GitHub organisation: D-Modem-RE is now D-Modem/D-Modem, pico-serial is D-Modem/hardware, modemmenu (PBX-Modem) is D-Modem/menu, bbs-sec is D-Modem/bbs and go3270-sec is D-Modem/go3270. Update links, module paths, submodule URLs and source-location strings to match. Copyright notices still name Neo-Desktop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRUwD2JJ5d6fgHmpVTw
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package confedit
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"regexp"
|
|
"sort"
|
|
"testing"
|
|
|
|
bbssec "github.com/D-Modem/bbs"
|
|
)
|
|
|
|
// TestEveryKeyKnown: each key the loader reads is in the sample (and so
|
|
// has help in the editor).
|
|
func TestEveryKeyKnown(t *testing.T) {
|
|
c := NewCatalog(bbssec.Sample)
|
|
known := map[string]bool{}
|
|
for _, k := range c.Kinds {
|
|
for _, x := range k.Keys {
|
|
known[x.Name] = true
|
|
}
|
|
}
|
|
re := regexp.MustCompile(`\.(?:String|Bool|Int|Seconds|Size|Has)\("([a-z0-9_]+)"|\{"([a-z0-9_]+)", &`)
|
|
files, _ := filepath.Glob("../server/*.go")
|
|
var missing []string
|
|
for _, f := range files {
|
|
if filepath.Ext(f) != ".go" || len(f) > 8 && f[len(f)-8:] == "_test.go" {
|
|
continue
|
|
}
|
|
data, err := os.ReadFile(f)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, m := range re.FindAllStringSubmatch(string(data), -1) {
|
|
k := m[1] + m[2]
|
|
if !known[k] {
|
|
missing = append(missing, filepath.Base(f)+": "+k)
|
|
known[k] = true
|
|
}
|
|
}
|
|
}
|
|
sort.Strings(missing)
|
|
for _, m := range missing {
|
|
t.Errorf("not in bbs.conf.sample: %s", m)
|
|
}
|
|
}
|