| 21 | } |
| 22 | |
| 23 | func TestValidate(t *testing.T) { |
| 24 | for _, tt := range validateTests { |
| 25 | err := validate(tt.key, tt.val) |
| 26 | if tt.err == "" && err != nil { |
| 27 | t.Errorf("validate(%q, %q): got %v, want nil", tt.key, tt.val, err) |
| 28 | } |
| 29 | if tt.err != "" { |
| 30 | if err == nil { |
| 31 | t.Errorf("validate(%q, %q): got nil error, want %v", tt.key, tt.val, tt.err) |
| 32 | } else if err.Error() != tt.err { |
| 33 | t.Errorf("validate(%q, %q): got err %v, want %v", tt.key, tt.val, err, tt.err) |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func TestDefault(t *testing.T) { |
| 40 | if v := Default("VisualHostKey"); v != "no" { |