File tree 2 files changed +33
-1
lines changed
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,35 @@ public void CanConcatenateQuotedString()
171
171
Assert . Equal ( "Hello my name is Roger" , Parser . Parse ( hocon ) . GetString ( "a.c" ) ) ;
172
172
}
173
173
174
+ /*
175
+ * FACT:
176
+ * To get a string containing a substitution as an array element,
177
+ * you must use value concatenation with the substitution in the unquoted portion
178
+ */
179
+ [ Fact ]
180
+ public void CanConcatenateUnquotedStringOfArrayElement ( )
181
+ {
182
+ var hocon = @"a {
183
+ name = Roger
184
+ c = [Hello my name is ${a.name}]
185
+ }" ;
186
+ Assert . Equal ( "Hello my name is Roger" , Parser . Parse ( hocon ) . GetStringList ( "a.c" ) [ 0 ] ) ;
187
+ }
188
+
189
+ /*
190
+ * FACT:
191
+ * or can use value concatenation of a substitution and a quoted string.
192
+ */
193
+ [ Fact ]
194
+ public void CanConcatenateQuotedStringOfArrayElement ( )
195
+ {
196
+ var hocon = @"a {
197
+ name = Roger
198
+ c = [""Hello my name is ""${a.name}]
199
+ }" ;
200
+ Assert . Equal ( "Hello my name is Roger" , Parser . Parse ( hocon ) . GetStringList ( "a.c" ) [ 0 ] ) ;
201
+ }
202
+
174
203
/*
175
204
* FACT:
176
205
* Substitutions are resolved by looking up the path in the configuration.
Original file line number Diff line number Diff line change @@ -640,7 +640,10 @@ internal void ResolveValue(IHoconElement child)
640
640
$ "Sibling type:{ Type } , substitution type:{ child . Type } ") ;
641
641
}
642
642
643
- ( ( HoconField ) Parent ) . ResolveValue ( this ) ;
643
+ if ( Parent is HoconField hoconField )
644
+ {
645
+ hoconField . ResolveValue ( this ) ;
646
+ }
644
647
}
645
648
646
649
/// <summary>
You can’t perform that action at this time.
0 commit comments