File: secconf_test.go

package info (click to toggle)
golang-github-xordataexchange-crypt 0.0.2%2Bgit20170626.21.b2862e3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 164 kB
  • sloc: makefile: 2
file content (28 lines) | stat: -rw-r--r-- 517 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package secconf

import (
	"bytes"
	"testing"
)

var encodingTests = []struct {
	in, out string
}{
	{"secret", "secret"},
}

func TestEncoding(t *testing.T) {
	for _, tt := range encodingTests {
		encoded, err := Encode([]byte(tt.in), bytes.NewBufferString(pubring))
		if err != nil {
			t.Errorf(err.Error())
		}
		decoded, err := Decode(encoded, bytes.NewBufferString(secring))
		if err != nil {
			t.Errorf(err.Error())
		}
		if tt.out != string(decoded) {
			t.Errorf("want %s, got %s", tt.out, decoded)
		}
	}
}