@ de62e8f8076f6010f59527991dbc61d7625a603e | history
package ast
import (
"slices"
"testing"
"government/eval"
)
func TestBuiltinsMatchEvaluator(t *testing.T) {
// The structural names are values in source (or reader syntax), not
// symbols, so the evaluator never sees them as names.
structural := []string{ListNode, Dot, True, False, Empty}
var named []string
for _, b := range builtinCodes {
if !slices.Contains(structural, b.name) {
named = append(named, b.name)
}
}
slices.Sort(named)
if reserved := eval.ReservedNames(); !slices.Equal(named, reserved) {
t.Errorf("builtin codes name %v\nevaluator reserves %v", named, reserved)
}
}