@@ -531,6 +531,14 @@ func TestVariableValues(t *testing.T) {
531531 }
532532 lx = lex ("foo $bar" )
533533 expect (t , lx , expectedItems )
534+
535+ expectedItems = []item {
536+ {itemKey , "foo" , 1 , 0 },
537+ {itemVariable , "bar" , 1 , 8 },
538+ {itemEOF , "" , 1 , 0 },
539+ }
540+ lx = lex ("foo = ${bar}" )
541+ expect (t , lx , expectedItems )
534542}
535543
536544func TestArrays (t * testing.T ) {
@@ -711,6 +719,22 @@ func TestNestedMaps(t *testing.T) {
711719 expect (t , lx , expectedItems )
712720}
713721
722+ func TestSimpleMapWithVariable (t * testing.T ) {
723+ expectedItems := []item {
724+ {itemKey , "foo" , 1 , 0 },
725+ {itemMapStart , "" , 1 , 7 },
726+ {itemKey , "ip" , 1 , 7 },
727+ {itemVariable , "IP" , 1 , 12 },
728+ {itemKey , "port" , 1 , 17 },
729+ {itemVariable , "PORT" , 1 , 26 },
730+ {itemMapEnd , "" , 1 , 32 },
731+ {itemEOF , "" , 1 , 0 },
732+ }
733+
734+ lx := lex ("foo = {ip=${IP}, port = ${PORT}}" )
735+ expect (t , lx , expectedItems )
736+ }
737+
714738func TestQuotedKeys (t * testing.T ) {
715739 expectedItems := []item {
716740 {itemKey , "foo" , 1 , 0 },
0 commit comments