Browse Source

uncomment tests

pull/1842/head
Anton Kaliaev 7 years ago
parent
commit
541780c6df
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 7 additions and 13 deletions
  1. +7
    -13
      cli/setup_test.go

+ 7
- 13
cli/setup_test.go View File

@ -57,12 +57,9 @@ func TestSetupEnv(t *testing.T) {
func TestSetupConfig(t *testing.T) {
// we pre-create two config files we can refer to in the rest of
// the test cases.
cval1, cval2 := "fubble", "wubble"
cval1 := "fubble"
conf1, err := WriteDemoConfig(map[string]string{"boo": cval1})
require.Nil(t, err)
// make sure it handles dashed-words in the config, and ignores random info
conf2, err := WriteDemoConfig(map[string]string{"boo": cval2, "foo": "bar", "two-words": "WORD"})
require.Nil(t, err)
cases := []struct {
args []string
@ -76,14 +73,11 @@ func TestSetupConfig(t *testing.T) {
{[]string{"--two-words", "rocks"}, nil, "", "rocks"},
{[]string{"--home", conf1}, nil, cval1, ""},
// test both variants of the prefix
//{nil, map[string]string{"RD_BOO": "bang"}, "bang", ""},
//{nil, map[string]string{"RD_TWO_WORDS": "fly"}, "", "fly"},
//{nil, map[string]string{"RDTWO_WORDS": "fly"}, "", "fly"},
//{nil, map[string]string{"RD_ROOT": conf1}, cval1, ""},
//{nil, map[string]string{"RDROOT": conf2}, cval2, "WORD"},
//{nil, map[string]string{"RDHOME": conf1}, cval1, ""},
// and when both are set??? HOME wins every time!
{[]string{"--home", conf1}, map[string]string{"RDHOME": conf2}, cval2, "WORD"},
{nil, map[string]string{"RD_BOO": "bang"}, "bang", ""},
{nil, map[string]string{"RD_TWO_WORDS": "fly"}, "", "fly"},
{nil, map[string]string{"RDTWO_WORDS": "fly"}, "", "fly"},
{nil, map[string]string{"RD_HOME": conf1}, cval1, ""},
{nil, map[string]string{"RDHOME": conf1}, cval1, ""},
}
for idx, tc := range cases {
@ -159,7 +153,7 @@ func TestSetupUnmarshal(t *testing.T) {
{[]string{"--home", conf1}, nil, c(cval1, 0)},
// test both variants of the prefix
{nil, map[string]string{"MR_AGE": "56"}, c("", 56)},
//{nil, map[string]string{"MR_ROOT": conf1}, c(cval1, 0)},
{nil, map[string]string{"MR_HOME": conf1}, c(cval1, 0)},
{[]string{"--age", "17"}, map[string]string{"MRHOME": conf2}, c(cval2, 17)},
}


Loading…
Cancel
Save