You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
emdbed/emdbed_test.go

29 lines
589 B

package emdbed
import (
"embed"
"strings"
"testing"
"github.com/matryer/is"
)
//go:embed testdata
var testdata embed.FS
func TestIdempotent(t *testing.T) {
assert := is.NewRelaxed(t)
fi, err := testdata.Open("testdata/main.md")
defer fi.Close()
out, err := Convert("testdata", fi)
assert.NoErr(err) // Conversion should be successful
idem := out
for idx := 0; idx < 100; idx++ {
idem, err = Convert("testdata", strings.NewReader(idem))
assert.NoErr(err) // Conversion should be successful
}
assert.Equal(out, idem) // Original output should match after 100 tries
}