(t *testing.T)
| 439 | } |
| 440 | |
| 441 | func 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) { |
nothing calls this directly
no test coverage detected