| 1 | package ssh_configscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.18 testing/" |
| 5 | ) |
| 6 | |
| 7 | var validateTestsscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests. = []struct { |
| 8 | keyscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:key. string |
| 9 | valscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:val. string |
| 10 | errscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:err. string |
| 11 | }{ |
| 12 | {"IdentitiesOnly", "yes", ""}, |
| 13 | {"IdentitiesOnly", "Yes", `ssh_config: value for key "IdentitiesOnly" must be 'yes' or 'no', got "Yes"`}, |
| 14 | {"Port", "22", ``}, |
| 15 | {"Port", "yes", `ssh_config: strconv.ParseUint: parsing "yes": invalid syntax`}, |
| 16 | } |
| 17 | |
| 18 | func TestValidatescip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/TestValidate().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 19 | for _, tt := range validateTestsscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests. { |
| 20 | err := validatescip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validate().(tt.keyscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:key., tt.valscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:val.) |
| 21 | if tt.errscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:err. == "" && err != nil { |
| 22 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("validate(%q, %q): got %v, want nil", tt.keyscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:key., tt.valscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:val., err) |
| 23 | } |
| 24 | if tt.errscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:err. != "" { |
| 25 | if err == nil { |
| 26 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("validate(%q, %q): got nil error, want %v", tt.keyscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:key., tt.valscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:val., tt.errscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:err.) |
| 27 | } else if err.Error() != tt.errscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:err. { |
| 28 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("validate(%q, %q): got err %v, want %v", tt.keyscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:key., tt.valscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:val., err, tt.errscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/validateTests:err.) |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | func TestDefaultscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/TestDefault().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 35 | if v := Defaultscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/Default().("VisualHostKey"); v != "no" { |
| 36 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Default(%q): got %v, want 'no'", "VisualHostKey", v) |
| 37 | } |
| 38 | if v := Defaultscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/Default().("visualhostkey"); v != "no" { |
| 39 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Default(%q): got %v, want 'no'", "visualhostkey", v) |
| 40 | } |
| 41 | if v := Defaultscip-go gomod github.com/dimonomid/ssh_config . `github.com/dimonomid/ssh_config`/Default().("notfound"); v != "" { |
| 42 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Default(%q): got %v, want ''", "notfound", v) |
| 43 | } |
| 44 | } |