mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 01:57:02 +00:00
chore: create Lua test helper (#532)
* Create lua test helper Signed-off-by: James Hillyerd <james@hillyerd.com> * Assert labels Signed-off-by: James Hillyerd <james@hillyerd.com> --------- Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
@@ -4,9 +4,9 @@ import (
|
||||
"net/mail"
|
||||
"testing"
|
||||
|
||||
"github.com/inbucket/inbucket/v3/pkg/test"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
)
|
||||
|
||||
func TestMailAddressGetters(t *testing.T) {
|
||||
@@ -26,8 +26,9 @@ func TestMailAddressGetters(t *testing.T) {
|
||||
assert(got == want, string.format("got address %q, want %q", got, want))
|
||||
`
|
||||
|
||||
ls := lua.NewState()
|
||||
ls, _ := test.NewLuaState()
|
||||
registerMailAddressType(ls)
|
||||
|
||||
ls.SetGlobal("addr", wrapMailAddress(ls, want))
|
||||
require.NoError(t, ls.DoString(script))
|
||||
}
|
||||
@@ -44,9 +45,10 @@ func TestMailAddressSetters(t *testing.T) {
|
||||
addr.address = "ri@example.com"
|
||||
`
|
||||
|
||||
got := &mail.Address{}
|
||||
ls := lua.NewState()
|
||||
ls, _ := test.NewLuaState()
|
||||
registerMailAddressType(ls)
|
||||
|
||||
got := &mail.Address{}
|
||||
ls.SetGlobal("addr", wrapMailAddress(ls, got))
|
||||
require.NoError(t, ls.DoString(script))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user