MCPcopy Index your code
hub / github.com/coder/coder / Test_sshConfigOptions_addOption

Function Test_sshConfigOptions_addOption

cli/configssh_internal_test.go:441–515  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

439}
440
441func Test_sshConfigOptions_addOption(t *testing.T) {
442 t.Parallel()
443 testCases := []struct {
444 Name string
445 Start []string
446 Add []string
447 Expect []string
448 ExpectError bool
449 }{
450 {
451 Name: "Empty",
452 },
453 {
454 Name: "AddOne",
455 Add: []string{"foo bar"},
456 Expect: []string{
457 "foo bar",
458 },
459 },
460 {
461 Name: "AddTwo",
462 Start: []string{
463 "foo bar",
464 },
465 Add: []string{"Foo baz"},
466 Expect: []string{
467 "foo bar",
468 "Foo baz",
469 },
470 },
471 {
472 Name: "AddAndRemove",
473 Start: []string{
474 "foo bar",
475 "buzz bazz",
476 },
477 Add: []string{
478 "b c",
479 "a ", // Empty value, means remove all following entries that start with "a", i.e. next line.
480 "A hello",
481 "hello world",
482 },
483 Expect: []string{
484 "foo bar",
485 "buzz bazz",
486 "b c",
487 "hello world",
488 },
489 },
490 {
491 Name: "Error",
492 Add: []string{"novalue"},
493 ExpectError: true,
494 },
495 }
496
497 for _, tt := range testCases {
498 t.Run(tt.Name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 4

addOptionsMethod · 0.95
RunMethod · 0.65
ErrorMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected