Files
avo/internal/gen/constructors_test.go
2018-11-25 21:50:46 -08:00

29 lines
559 B
Go

package gen
import (
"testing"
"github.com/mmcloughlin/avo/internal/inst"
)
func TestParamsUniqueArgNames(t *testing.T) {
for _, i := range inst.Instructions {
_, argname := params(i)
for _, n := range i.Arities() {
if n == 0 {
continue
}
names := map[string]bool{}
for j := 0; j < n; j++ {
names[argname(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)
}
}
}
}