mirror of
https://git.mills.io/saltyim/saltyim.git
synced 2024-06-28 09:41:02 +00:00
25 lines
469 B
Go
25 lines
469 B
Go
![]() |
package saltyim_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
"go.yarn.social/lextwt"
|
||
|
)
|
||
|
|
||
|
func assertMessage(t *testing.T, text, user, expected string) {
|
||
|
t.Helper()
|
||
|
|
||
|
assert := assert.New(t)
|
||
|
require := require.New(t)
|
||
|
|
||
|
s, err := lextwt.ParseSalty(text)
|
||
|
require.NoError(err)
|
||
|
|
||
|
st, ok := s.(*lextwt.SaltyText)
|
||
|
require.True(ok)
|
||
|
assert.Equal(st.User.String(), user)
|
||
|
assert.Equal(st.LiteralText(), expected)
|
||
|
}
|