Skip to content

Commit 65d83f2

Browse files
committed
fix test and case insensitivity
1 parent 62ada21 commit 65d83f2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cli/configssh.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (o *sshConfigOptions) addOption(option string) error {
7575
if err != nil {
7676
return err
7777
}
78-
if o.removedKeys != nil && o.removedKeys[key] {
78+
if o.removedKeys != nil && o.removedKeys[strings.ToLower(key)] {
7979
// Key marked as removed, skip.
8080
return nil
8181
}
@@ -87,7 +87,7 @@ func (o *sshConfigOptions) addOption(option string) error {
8787
if o.removedKeys == nil {
8888
o.removedKeys = make(map[string]bool)
8989
}
90-
o.removedKeys[key] = true
90+
o.removedKeys[strings.ToLower(key)] = true
9191
}
9292
return nil
9393
}

cli/configssh_internal_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,32 +272,32 @@ func Test_sshConfigOptions_addOption(t *testing.T) {
272272
},
273273
},
274274
{
275-
Name: "Replace",
275+
Name: "AddTwo",
276276
Start: []string{
277277
"foo bar",
278278
},
279279
Add: []string{"Foo baz"},
280280
Expect: []string{
281+
"foo bar",
281282
"Foo baz",
282283
},
283284
},
284285
{
285-
Name: "AddAndReplace",
286+
Name: "AddAndRemove",
286287
Start: []string{
287-
"a b",
288288
"foo bar",
289289
"buzz bazz",
290290
},
291291
Add: []string{
292292
"b c",
293+
"a=", // Remove all entries that start with "a", i.e. next line.
293294
"A hello",
294295
"hello world",
295296
},
296297
Expect: []string{
297298
"foo bar",
298299
"buzz bazz",
299300
"b c",
300-
"A hello",
301301
"hello world",
302302
},
303303
},

0 commit comments

Comments
 (0)