Skip to content

Commit

Permalink
wit: improve renamed function test
Browse files Browse the repository at this point in the history
  • Loading branch information
ydnar committed Sep 24, 2023
1 parent 3d64f3c commit a947cf7
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions wit/abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,27 @@ func TestFunctionNameConsistency(t *testing.T) {
}
name := fmt.Sprintf("Worlds[%d]#%s", i, w.Name)
t.Run(name, func(t *testing.T) {
for name, item := range w.Imports {
f, ok := item.(*Function)
if !ok {
continue
}
t.Run(fmt.Sprintf("Imports[%q]==%q", name, f.Name), func(t *testing.T) {
if name != f.Name {
// A world can rename an imported function, so disable this
// t.Errorf("Imports[%q] != %q", name, f.Name)
}
})
}
// A world can rename an imported function, so disable this
// for name, item := range w.Imports {
// f, ok := item.(*Function)
// if !ok {
// continue
// }
// t.Run(fmt.Sprintf("Imports[%q]==%q", name, f.Name), func(t *testing.T) {
// if name != f.Name {
// t.Errorf("Imports[%q] != %q", name, f.Name)
// }
// })
// }

// TODO: can a world rename an exported function?
for name, item := range w.Exports {
f, ok := item.(*Function)
if !ok {
continue
}
t.Run(fmt.Sprintf("Exports[%q]==%q", name, f.Name), func(t *testing.T) {
if name != f.Name {
// TODO: can a world rename an exported function?
t.Errorf("Exports[%q] != %q", name, f.Name)
}
})
Expand Down

0 comments on commit a947cf7

Please sign in to comment.