mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 13:16:53 +00:00
feat: initial parser exposing walker/writer
This commit is contained in:
39
pkg/message/parser/parser_test.go
Normal file
39
pkg/message/parser/parser_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func newTestParser(t *testing.T, msg string) *Parser {
|
||||
r := f(msg)
|
||||
|
||||
p, err := New(r)
|
||||
require.NoError(t, err)
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func f(filename string) io.ReadCloser {
|
||||
f, err := os.Open(filepath.Join("testdata", filename))
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func s(filename string) string {
|
||||
b, err := ioutil.ReadAll(f(filename))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return string(b)
|
||||
}
|
||||
Reference in New Issue
Block a user