| 1 |
package secconf |
| 2 |
|
| 3 |
import ( |
| 4 |
"bytes" |
| 5 |
"testing" |
| 6 |
) |
| 7 |
|
| 8 |
var encodingTests = []struct { |
| 9 |
in, out string |
| 10 |
}{ |
| 11 |
{"secret", "secret"}, |
| 12 |
} |
| 13 |
|
| 14 |
func TestEncoding(t *testing.T) { |
| 15 |
for _, tt := range encodingTests { |
| 16 |
encoded, err := Encode([]byte(tt.in), bytes.NewBufferString(pubring)) |
| 17 |
if err != nil { |
| 18 |
t.Errorf(err.Error()) |
| 19 |
} |
| 20 |
decoded, err := Decode(encoded, bytes.NewBufferString(secring)) |
| 21 |
if err != nil { |
| 22 |
t.Errorf(err.Error()) |
| 23 |
} |
| 24 |
if tt.out != string(decoded) { |
| 25 |
t.Errorf("want %s, got %s", tt.out, decoded) |
| 26 |
} |
| 27 |
} |
| 28 |
} |