diff --git a/error.go b/error.go index 646e1b97..8be99bf6 100644 --- a/error.go +++ b/error.go @@ -18,7 +18,7 @@ func (e *Error) String() string { func (e *Error) Error() string { var message bytes.Buffer - fmt.Fprintf(&message, "syntax error:%s: %s\n", e.Position, e.Message) + fmt.Fprintf(&message, "syntax error: %s: %s\n", e.Position, e.Message) if e.Position.Source != "" { fmt.Fprintln(&message) fmt.Fprint(&message, e.Position.Source) diff --git a/parser_test.go b/parser_test.go index 80a7328f..dbe2ed20 100644 --- a/parser_test.go +++ b/parser_test.go @@ -47,14 +47,15 @@ func testParser(t *testing.T, inputPath, resultPath string, parse func(p *memefi t.Run(in.Name(), func(t *testing.T) { t.Parallel() - b, err := os.ReadFile(filepath.Join(inputPath, in.Name())) + inputFilePath := filepath.Join(inputPath, in.Name()) + b, err := os.ReadFile(inputFilePath) if err != nil { t.Fatalf("error on reading input file: %v", err) } p := &memefish.Parser{ Lexer: &memefish.Lexer{ - File: &token.File{FilePath: in.Name(), Buffer: string(b)}, + File: &token.File{FilePath: inputFilePath, Buffer: string(b)}, }, }