add skeleton for instruction constructors
This commit is contained in:
28
internal/gen/constructors_test.go
Normal file
28
internal/gen/constructors_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user