From 0feb0d9244339b15085f84bd2757769e800505b9 Mon Sep 17 00:00:00 2001 From: Paulo L F Casaretto Date: Mon, 19 Oct 2015 23:36:34 -0200 Subject: [PATCH] Test validDirective function --- config/config_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/config/config_test.go b/config/config_test.go index e4877016..a2c4f961 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -102,3 +102,23 @@ func TestMakeStorages(t *testing.T) { t.Errorf("storages was %v, expected %v", storages, expected) } } + +func TestValidDirective(t *testing.T) { + directives := []directive{ + {"dummy", nil}, + {"dummy2", nil}, + } + directiveOrder = directives + for i, test := range []struct { + directive string + valid bool + }{ + {"dummy", true}, + {"dummy2", true}, + {"dummy3", false}, + } { + if actual, expected := validDirective(test.directive), test.valid; actual != expected { + t.Errorf("Test %d: valid was %t, expected %t", i, actual, expected) + } + } +}