feat: initial parser exposing walker/writer

This commit is contained in:
James Houlahan
2020-06-30 17:43:04 +02:00
parent 7207a5d59e
commit 6ea3fc1963
10 changed files with 513 additions and 0 deletions

View 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)
}