Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine file path in syntax error of parser_test.go #139

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
},
}

Expand Down
Loading