File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,11 @@ func TestValidUnexistentInterpolation(t *testing.T) {
119
119
{test : "{{{ ${BAR} }}}" , expected : "{{{ }}}" },
120
120
{test : "${FOO:?baz} }}}" , errMsg : "baz" },
121
121
{test : "${FOO?baz} }}}" , errMsg : "baz" },
122
+ // nested variables
123
+ {test : "${FOO:-${BAR:-${ZOT:-qix}}}" , expected : "qix" },
124
+ {test : "${FOO:-${BAR:-x}_test_${BAR:-y}}" , expected : "x_test_y" },
125
+ {test : "${FOO:-${BAR:-x}_test}" , expected : "x_test" },
126
+ {test : "${FOO:-${BAR:-${ZOT:-x}}_test}" , expected : "x_test" },
122
127
}
123
128
124
129
getServiceConfig := func (val string ) map [string ]interface {} {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import (
28
28
var delimiter = "\\ $"
29
29
var substitutionNamed = "[_a-z][_a-z0-9]*"
30
30
31
- var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-+?](.*}|[^}]* ))?"
31
+ var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-+?](.*))?"
32
32
33
33
var patternString = fmt .Sprintf (
34
34
"%s(?i:(?P<escaped>%s)|(?P<named>%s)|{(?:(?P<braced>%s)}|(?P<invalid>)))" ,
You can’t perform that action at this time.
0 commit comments