aboutsummaryrefslogtreecommitdiff
path: root/config_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-05-15 20:37:59 +0700
committerShulhan <ms@kilabit.info>2023-05-15 20:37:59 +0700
commitf59e59c029a0332e7fd63e0cd5ea7fb30eb7d991 (patch)
treeaeea5f62b8f0ec9bd131d9fb4c5643f419c39cc1 /config_test.go
parentd887d308d9afad21a7b6b6385713c6c4ee0b1463 (diff)
downloadgotp-f59e59c029a0332e7fd63e0cd5ea7fb30eb7d991.tar.xz
all: add function loadConfig
The loadConfig load the configuration from raw bytes. This replace part of newConfig with loadConfig to minimize duplicate. The idea of loadConfig is to simplify testing later.
Diffstat (limited to 'config_test.go')
-rw-r--r--config_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/config_test.go b/config_test.go
index 772ea1e..c0b1993 100644
--- a/config_test.go
+++ b/config_test.go
@@ -18,6 +18,13 @@ func TestNewConfig(t *testing.T) {
}
var cases = []testCase{{
+ desc: `With file not exist`,
+ configFile: `testdata/config-not-exist`,
+ expConfig: &config{
+ file: `testdata/config-not-exist`,
+ isNotExist: true,
+ },
+ }, {
desc: `With openssh rsa`,
configFile: `testdata/rsa.conf`,
expConfig: &config{