Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e131eb

Browse files
committed
fix test and case insensitivity
1 parent62ada21 commit8e131eb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

‎cli/configssh.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func (o *sshConfigOptions) addOption(option string) error {
7575
iferr!=nil {
7676
returnerr
7777
}
78-
ifo.removedKeys!=nil&&o.removedKeys[key] {
78+
lowerKey:=strings.ToLower(key)
79+
ifo.removedKeys!=nil&&o.removedKeys[lowerKey] {
7980
// Key marked as removed, skip.
8081
returnnil
8182
}
@@ -87,7 +88,7 @@ func (o *sshConfigOptions) addOption(option string) error {
8788
ifo.removedKeys==nil {
8889
o.removedKeys=make(map[string]bool)
8990
}
90-
o.removedKeys[key]=true
91+
o.removedKeys[lowerKey]=true
9192
}
9293
returnnil
9394
}

‎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)

[8]ページ先頭

©2009-2025 Movatter.jp