mirror of https://github.com/aldy505/cheapcash.git
test: panic on new
This commit is contained in:
parent
a533c96551
commit
f199ca0c86
|
@ -1,6 +1,7 @@
|
|||
package cheapcash_test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
|
@ -29,6 +30,19 @@ func TestNew(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestNew_InvalidPath(t *testing.T) {
|
||||
defer func(){
|
||||
if e := recover().(error); e != nil {
|
||||
if !errors.Is(e, cheapcash.ErrInvalidPath) {
|
||||
t.Error("expected ErrInvalidPath, got:", e)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
_ = cheapcash.New("")
|
||||
|
||||
}
|
||||
|
||||
func removeDirIfExists(path string) {
|
||||
dir, err := os.Stat(path)
|
||||
if err == nil {
|
||||
|
|
Loading…
Reference in New Issue