passforios-gopenpgp/crypto/base_test.go

20 lines
301 B
Go
Raw Normal View History

2019-05-13 14:06:54 +00:00
package crypto
import (
"io/ioutil"
2019-05-14 16:08:25 +00:00
"strings"
2019-05-13 14:06:54 +00:00
)
var err error
2019-05-14 16:08:25 +00:00
func readTestFile(name string, trimNewlines bool) string {
2019-05-13 14:06:54 +00:00
data, err := ioutil.ReadFile("testdata/" + name)
if err != nil {
panic(err)
}
2019-05-14 16:08:25 +00:00
if trimNewlines {
return strings.TrimRight(string(data), "\n")
}
2019-05-13 14:06:54 +00:00
return string(data)
}