diff options
author | 2016-03-18 20:57:35 +0000 | |
---|---|---|
committer | 2016-03-18 20:57:35 +0000 | |
commit | 3ec0d9fe6b133a64712ae69fd712c14ad1a71f4d (patch) | |
tree | fae74c33cfed05de603785294593275f1901c861 /server/config_test.go | |
download | coredns-3ec0d9fe6b133a64712ae69fd712c14ad1a71f4d.tar.gz coredns-3ec0d9fe6b133a64712ae69fd712c14ad1a71f4d.tar.zst coredns-3ec0d9fe6b133a64712ae69fd712c14ad1a71f4d.zip |
First commit
Diffstat (limited to 'server/config_test.go')
-rw-r--r-- | server/config_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/server/config_test.go b/server/config_test.go new file mode 100644 index 000000000..8787e467b --- /dev/null +++ b/server/config_test.go @@ -0,0 +1,25 @@ +package server + +import "testing" + +func TestConfigAddress(t *testing.T) { + cfg := Config{Host: "foobar", Port: "1234"} + if actual, expected := cfg.Address(), "foobar:1234"; expected != actual { + t.Errorf("Expected '%s' but got '%s'", expected, actual) + } + + cfg = Config{Host: "", Port: "1234"} + if actual, expected := cfg.Address(), ":1234"; expected != actual { + t.Errorf("Expected '%s' but got '%s'", expected, actual) + } + + cfg = Config{Host: "foobar", Port: ""} + if actual, expected := cfg.Address(), "foobar:"; expected != actual { + t.Errorf("Expected '%s' but got '%s'", expected, actual) + } + + cfg = Config{Host: "::1", Port: "443"} + if actual, expected := cfg.Address(), "[::1]:443"; expected != actual { + t.Errorf("Expected '%s' but got '%s'", expected, actual) + } +} |