aboutsummaryrefslogtreecommitdiff
path: root/config_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-03-16 17:40:06 +0700
committerShulhan <ms@kilabit.info>2024-03-16 17:40:06 +0700
commite8e3cb778a2238fe915d05b690b9dbeb2c4e2a8a (patch)
treeb27ba3cac3899e2d2fe6ec2fa70eb92e85e8e9a8 /config_test.go
parent1e7d8e360eac2c815ac7b79ddf5ec11253833f95 (diff)
downloadhaminer-e8e3cb778a2238fe915d05b690b9dbeb2c4e2a8a.tar.xz
all: replace module "share" with "pakakeh.go"
Diffstat (limited to 'config_test.go')
-rw-r--r--config_test.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/config_test.go b/config_test.go
index d2c4601..f259dbf 100644
--- a/config_test.go
+++ b/config_test.go
@@ -4,11 +4,12 @@
package haminer
import (
+ "os"
"regexp"
"testing"
"time"
- "github.com/shuLhan/share/lib/test"
+ "git.sr.ht/~shulhan/pakakeh.go/lib/test"
)
func TestNewConfig(t *testing.T) {
@@ -41,6 +42,8 @@ func TestLoad(t *testing.T) {
expError string
}
+ _ = os.Remove(`testdata/notexist.conf`)
+
var cases = []testCase{{
desc: "With empty path",
exp: &Config{
@@ -49,9 +52,13 @@ func TestLoad(t *testing.T) {
ForwardInterval: defForwardInterval,
},
}, {
- desc: `With path not exist`,
- in: `testdata/notexist.conf`,
- expError: `Load: open testdata/notexist.conf: no such file or directory`,
+ desc: `With path not exist`,
+ in: `testdata/notexist.conf`,
+ exp: &Config{
+ listenAddr: defListenAddr,
+ listenPort: defListenPort,
+ ForwardInterval: defForwardInterval,
+ },
}, {
desc: "With path exist",
in: "testdata/haminer.conf",
@@ -111,6 +118,7 @@ func TestLoad(t *testing.T) {
got = NewConfig()
err = got.Load(c.in)
if err != nil {
+ t.Logf(`err=%s`, err)
test.Assert(t, `error`, c.expError, err.Error())
continue
}