@@ -716,10 +716,8 @@ func TestPrintableText(t *testing.T) {
|
||||
err := PrintableText()(&str)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
|
||||
// The null byte is at rune position 3 (after 'a', 'b', 'c')
|
||||
if !strings.Contains(err.Message, "position 3") {
|
||||
} else if !strings.Contains(err.Message, "position 3") {
|
||||
// The null byte is at rune position 3 (after 'a', 'b', 'c')
|
||||
t.Errorf("expected position 3 in error message, got: %s", err.Message)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -35,9 +35,7 @@ func TestAfter(t *testing.T) {
|
||||
err := After(future)(&past)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
|
||||
if err.Code != ErrorCodeOutOfRange {
|
||||
} else if err.Code != ErrorCodeOutOfRange {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeOutOfRange, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -75,9 +73,7 @@ func TestBefore(t *testing.T) {
|
||||
err := Before(past)(&future)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
|
||||
if err.Code != ErrorCodeOutOfRange {
|
||||
} else if err.Code != ErrorCodeOutOfRange {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeOutOfRange, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -136,9 +132,7 @@ func TestRangeDuration(t *testing.T) {
|
||||
err := RangeDuration(minDuration, maxDuration)(&duration)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
|
||||
if err.Code != ErrorCodeOutOfRange {
|
||||
} else if err.Code != ErrorCodeOutOfRange {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeOutOfRange, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -149,9 +143,7 @@ func TestRangeDuration(t *testing.T) {
|
||||
err := RangeDuration(minDuration, maxDuration)(&duration)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
|
||||
if err.Code != ErrorCodeOutOfRange {
|
||||
} else if err.Code != ErrorCodeOutOfRange {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeOutOfRange, err.Code)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user