mirror of
https://git.mills.io/saltyim/saltyim.git
synced 2024-06-25 00:08:26 +00:00
![James Mills](/assets/img/avatar_default.png)
Co-authored-by: James Mills <1290234+prologic@users.noreply.github.com> Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/180
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)
|
|
}
|