@@ -29,7 +29,7 @@ func TestInjectAttributes(t *testing.T) {
2929 name : "interpolation with variable" ,
3030 attrByte : []byte (`{"a": "${var.b}"}` ),
3131 varValues : map [string ]json.RawMessage {
32- "${var.b}" : json .RawMessage (`c ` ),
32+ ` "${var.b}"` : json .RawMessage (`"c" ` ),
3333 },
3434 expected : property.Values {
3535 "a" : json .RawMessage (`"c"` ),
@@ -39,7 +39,7 @@ func TestInjectAttributes(t *testing.T) {
3939 name : "interpolation with output" ,
4040 attrByte : []byte (`{"a": "${res.b.c}"}` ),
4141 outputValues : map [string ]property.Value {
42- "${res.b.c}" : property .Value (`d ` ),
42+ ` "${res.b.c}"` : property .Value (`"d" ` ),
4343 },
4444 expected : property.Values {
4545 "a" : json .RawMessage (`"d"` ),
@@ -49,14 +49,24 @@ func TestInjectAttributes(t *testing.T) {
4949 name : "interpolation with variable have newline" ,
5050 attrByte : []byte (`{"a": "${var.b}"}` ),
5151 varValues : map [string ]json.RawMessage {
52- "${var.b}" : json .RawMessage (`-----BEGIN RSA PRIVATE KEY-----
52+ ` "${var.b}"` : json .RawMessage (`" -----BEGIN RSA PRIVATE KEY-----
5353xxx
54- -----END RSA PRIVATE KEY-----` ),
54+ -----END RSA PRIVATE KEY-----" ` ),
5555 },
5656 expected : property.Values {
5757 "a" : json .RawMessage (`"-----BEGIN RSA PRIVATE KEY-----\nxxx\n-----END RSA PRIVATE KEY-----"` ),
5858 },
5959 },
60+ {
61+ name : "interpolation with empty variable" ,
62+ attrByte : []byte (`{"a": "${var.b}"}` ),
63+ varValues : map [string ]json.RawMessage {
64+ `"${var.b}"` : json .RawMessage (`""` ),
65+ },
66+ expected : property.Values {
67+ "a" : json .RawMessage (`""` ),
68+ },
69+ },
6070 }
6171
6272 for _ , c := range cases {
0 commit comments