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) {
119119 {test : "{{{ ${BAR} }}}" , expected : "{{{ }}}" },
120120 {test : "${FOO:?baz} }}}" , errMsg : "baz" },
121121 {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" },
122127 }
123128
124129 getServiceConfig := func (val string ) map [string ]interface {} {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import (
2828var delimiter = "\\ $"
2929var substitutionNamed = "[_a-z][_a-z0-9]*"
3030
31- var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-+?](.*}|[^}]* ))?"
31+ var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-+?](.*))?"
3232
3333var patternString = fmt .Sprintf (
3434 "%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