@@ -50,6 +50,15 @@ func TestExtractVariables(t *testing.T) {
50
50
"bar" : {Name : "bar" },
51
51
},
52
52
},
53
+ {
54
+ name : "variable-without-curly-braces-and-with-number-suffix" ,
55
+ dict : map [string ]interface {}{
56
+ "foo" : "$bar_1" ,
57
+ },
58
+ expected : map [string ]Variable {
59
+ "bar_1" : {Name : "bar_1" },
60
+ },
61
+ },
53
62
{
54
63
name : "variable" ,
55
64
dict : map [string ]interface {}{
@@ -68,6 +77,15 @@ func TestExtractVariables(t *testing.T) {
68
77
"bar" : {Name : "bar" , DefaultValue : "" , Required : true },
69
78
},
70
79
},
80
+ {
81
+ name : "required-variable-with-number-suffix" ,
82
+ dict : map [string ]interface {}{
83
+ "foo" : "${bar_1?:foo}" ,
84
+ },
85
+ expected : map [string ]Variable {
86
+ "bar_1" : {Name : "bar_1" , DefaultValue : "" , Required : true },
87
+ },
88
+ },
71
89
{
72
90
name : "required-variable2" ,
73
91
dict : map [string ]interface {}{
@@ -95,6 +113,24 @@ func TestExtractVariables(t *testing.T) {
95
113
"bar" : {Name : "bar" , DefaultValue : "foo" },
96
114
},
97
115
},
116
+ {
117
+ name : "default-variable-with-number-suffix" ,
118
+ dict : map [string ]interface {}{
119
+ "foo" : "${bar_1:-foo}" ,
120
+ },
121
+ expected : map [string ]Variable {
122
+ "bar_1" : {Name : "bar_1" , DefaultValue : "foo" },
123
+ },
124
+ },
125
+ {
126
+ name : "default-variable2-with-number-suffix" ,
127
+ dict : map [string ]interface {}{
128
+ "foo" : "${bar_1-foo}" ,
129
+ },
130
+ expected : map [string ]Variable {
131
+ "bar_1" : {Name : "bar_1" , DefaultValue : "foo" },
132
+ },
133
+ },
98
134
{
99
135
name : "multiple-values" ,
100
136
dict : map [string ]interface {}{
0 commit comments