mirror of
https://github.com/robertkrimen/otto
synced 2025-10-05 19:19:10 +08:00
[#148] Lower cased errors
This commit is contained in:
parent
36da11f822
commit
09ad467104
|
@ -13,15 +13,15 @@ func TestCommentMap(t *testing.T) {
|
|||
cm.AddComment(statement, comment)
|
||||
|
||||
if cm.Size() != 1 {
|
||||
t.Errorf("The number of comments is %v, not 1", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 1", cm.Size())
|
||||
}
|
||||
|
||||
if len(cm[statement]) != 1 {
|
||||
t.Errorf("The number of comments is %v, not 1", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 1", cm.Size())
|
||||
}
|
||||
|
||||
if cm[statement][0].Text != "test" {
|
||||
t.Errorf("The text is %v, not \"test\"", cm[statement][0].Text)
|
||||
t.Errorf("the text is %v, not \"test\"", cm[statement][0].Text)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,28 +34,28 @@ func TestCommentMap_move(t *testing.T) {
|
|||
cm.AddComment(statement1, comment)
|
||||
|
||||
if cm.Size() != 1 {
|
||||
t.Errorf("The number of comments is %v, not 1", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 1", cm.Size())
|
||||
}
|
||||
|
||||
if len(cm[statement1]) != 1 {
|
||||
t.Errorf("The number of comments is %v, not 1", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 1", cm.Size())
|
||||
}
|
||||
|
||||
if len(cm[statement2]) != 0 {
|
||||
t.Errorf("The number of comments is %v, not 0", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 0", cm.Size())
|
||||
}
|
||||
|
||||
cm.MoveComments(statement1, statement2, LEADING)
|
||||
|
||||
if cm.Size() != 1 {
|
||||
t.Errorf("The number of comments is %v, not 1", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 1", cm.Size())
|
||||
}
|
||||
|
||||
if len(cm[statement2]) != 1 {
|
||||
t.Errorf("The number of comments is %v, not 1", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 1", cm.Size())
|
||||
}
|
||||
|
||||
if len(cm[statement1]) != 0 {
|
||||
t.Errorf("The number of comments is %v, not 0", cm.Size())
|
||||
t.Errorf("the number of comments is %v, not 0", cm.Size())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ import (
|
|||
|
||||
func checkComments(actual []*ast.Comment, expected []string, position ast.CommentPosition) error {
|
||||
if len(actual) != len(expected) {
|
||||
return fmt.Errorf("The number of comments is not correct. %v != %v", len(actual), len(expected))
|
||||
return fmt.Errorf("the number of comments is not correct. %v != %v", len(actual), len(expected))
|
||||
}
|
||||
|
||||
for i, v := range actual {
|
||||
if v.Text != expected[i] {
|
||||
return fmt.Errorf("Comments do not match. \"%v\" != \"%v\"\n", v.Text, expected[i])
|
||||
return fmt.Errorf("comments do not match. \"%v\" != \"%v\"\n", v.Text, expected[i])
|
||||
}
|
||||
if v.Position != position {
|
||||
return fmt.Errorf("The comment is not %v, was %v\n", position, v.Position)
|
||||
return fmt.Errorf("the comment is not %v, was %v\n", position, v.Position)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user