Files
avo/internal/gen/ctors_test.go

29 lines
558 B
Go
Raw Normal View History

package gen
import (
"testing"
"github.com/mmcloughlin/avo/internal/inst"
)
func TestParamsUniqueArgNames(t *testing.T) {
for _, i := range inst.Instructions {
2018-11-26 10:13:04 -08:00
s := params(i)
for _, n := range i.Arities() {
if n == 0 {
continue
}
names := map[string]bool{}
for j := 0; j < n; j++ {
2018-11-26 10:13:04 -08:00
names[s.ParameterName(j)] = true
}
if len(names) != n {
t.Errorf("repeated argument for instruction %s", i.Opcode)
}
if _, found := names[""]; found {
t.Errorf("empty argument name for instruction %s", i.Opcode)
}
}
}
}