-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors_test.go
More file actions
38 lines (33 loc) · 903 Bytes
/
errors_test.go
File metadata and controls
38 lines (33 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package maml
import (
"testing"
)
func TestParseErrorError(t *testing.T) {
e := &ParseError{Message: "test error", Line: 1}
if e.Error() != "test error" {
t.Errorf("expected 'test error', got %q", e.Error())
}
}
func TestMarshalErrorError(t *testing.T) {
e := &MarshalError{Message: "test"}
expected := "maml: marshal error: test"
if e.Error() != expected {
t.Errorf("expected %q, got %q", expected, e.Error())
}
}
func TestUnmarshalErrorError(t *testing.T) {
e := &UnmarshalError{Message: "test"}
expected := "maml: unmarshal error: test"
if e.Error() != expected {
t.Errorf("expected %q, got %q", expected, e.Error())
}
}
func TestNewParseError(t *testing.T) {
e := newParseError("formatted message", 5)
if e.Message != "formatted message" {
t.Errorf("expected 'formatted message', got %q", e.Message)
}
if e.Line != 5 {
t.Errorf("expected line 5, got %d", e.Line)
}
}