-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package rnokpp_test | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/fre5h/rnokpp" | ||
) | ||
|
||
func TestErrNotAllowedDate(t *testing.T) { | ||
date, _ := time.Parse("02.04.2006", "31.12.1899") | ||
x := &rnokpp.ErrNotAllowedDate{Date: date} | ||
|
||
if x.Error() != "the allowed dates start from 01.01.1900, but your date 31.12.1899 is earlier" { | ||
t.Error("Wrong error message for ErrNotAllowedDate") | ||
} | ||
} | ||
|
||
func TestErrDateInFuture(t *testing.T) { | ||
date, _ := time.Parse("02.04.2006", "01.01.3000") | ||
x := &rnokpp.ErrDateInFuture{Date: date} | ||
|
||
if x.Error() != "it is allowed to use only dates in past or current date, but your date is in the future 01.01.3000" { | ||
t.Error("Wrong error message for ErrDateInFuture") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters