(t *testing.T)
| 81 | } |
| 82 | |
| 83 | func TestInterpolateWithCast(t *testing.T) { |
| 84 | config := map[string]any{ |
| 85 | "foo": map[string]any{ |
| 86 | "replicas": "$count", |
| 87 | }, |
| 88 | } |
| 89 | toInt := func(value string) (any, error) { |
| 90 | return strconv.Atoi(value) |
| 91 | } |
| 92 | result, err := Interpolate(config, Options{ |
| 93 | LookupValue: defaultMapping, |
| 94 | TypeCastMapping: map[Path]Cast{NewPath(PathMatchAll, "replicas"): toInt}, |
| 95 | }) |
| 96 | assert.NilError(t, err) |
| 97 | expected := map[string]any{ |
| 98 | "foo": map[string]any{ |
| 99 | "replicas": 5, |
| 100 | }, |
| 101 | } |
| 102 | assert.Check(t, is.DeepEqual(expected, result)) |
| 103 | } |
| 104 | |
| 105 | func TestPathMatches(t *testing.T) { |
| 106 | testcases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…