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.

20 lines
459 B

  1. package crypto
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. "github.com/stretchr/testify/require"
  6. )
  7. func TestSimpleArmor(t *testing.T) {
  8. blockType := "MINT TEST"
  9. data := []byte("somedata")
  10. armorStr := EncodeArmor(blockType, nil, data)
  11. // Decode armorStr and test for equivalence.
  12. blockType2, _, data2, err := DecodeArmor(armorStr)
  13. require.Nil(t, err, "%+v", err)
  14. assert.Equal(t, blockType, blockType2)
  15. assert.Equal(t, data, data2)
  16. }