(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestMergeParamName(t *testing.T) { |
| 53 | type test struct { |
| 54 | a Param |
| 55 | b Param |
| 56 | name string |
| 57 | } |
| 58 | |
| 59 | a := NewParam("a") |
| 60 | b := NewParam("b") |
| 61 | blank := NewParam("") |
| 62 | |
| 63 | tests := []test{ |
| 64 | // should prefer the first param's name if both specified |
| 65 | {a, b, "a"}, |
| 66 | {b, a, "b"}, |
| 67 | |
| 68 | // should prefer non-blank names |
| 69 | {a, blank, "a"}, |
| 70 | {blank, a, "a"}, |
| 71 | } |
| 72 | |
| 73 | for _, spec := range tests { |
| 74 | a := spec.a |
| 75 | b := spec.b |
| 76 | actual := mergeParam(a, b).Name() |
| 77 | expected := spec.name |
| 78 | if actual != expected { |
| 79 | t.Errorf("Combine(%s,%s) expected %v; got %v", a.name, b.name, expected, actual) |
| 80 | } |
| 81 | } |
| 82 | } |
nothing calls this directly
no test coverage detected