@@ -229,9 +229,12 @@ def test_expressions_in_strings():
229
229
230
230
content = """
231
231
flow main
232
- start UtteranceBotAction(script="Roger") as $ref
232
+ $xyz = 'x\\ 'y\\ 'z\\ n'
233
+ $test = '''Roger's
234
+ test:\n {$xyz}'''
235
+ start UtteranceBotAction(script=$test) as $ref
233
236
start UtteranceBotAction(script="It's {{->}}")
234
- start UtteranceBotAction(script='It"s {{->}} \\ '{$ref.start_event_arguments.script}!\\ '')
237
+ await UtteranceBotAction(script='It"s {{->}} \\ '{$ref.start_event_arguments.script}!\\ '')
235
238
"""
236
239
237
240
config = _init_state (content )
@@ -241,20 +244,44 @@ def test_expressions_in_strings():
241
244
[
242
245
{
243
246
"type" : "StartUtteranceBotAction" ,
244
- "script" : "Roger" ,
247
+ "script" : "Roger's \n test: \n x'y'z \n " ,
245
248
},
246
249
{
247
250
"type" : "StartUtteranceBotAction" ,
248
251
"script" : "It's {->}" ,
249
252
},
250
253
{
251
254
"type" : "StartUtteranceBotAction" ,
252
- "script" : "It\" s {->} 'Roger!'" ,
255
+ "script" : "It\" s {->} 'Roger's \n test: \n x'y'z \n !'" ,
253
256
},
254
257
],
255
258
)
256
259
257
260
261
+ def test_multiline_string ():
262
+ """Test string expression evaluation."""
263
+
264
+ content = '''
265
+ flow main
266
+ $var = "Test"
267
+ $string = """This is a multiline
268
+ string! '{$var}' "hi" """
269
+ start UtteranceBotAction(script=$string)
270
+ '''
271
+
272
+ config = _init_state (content )
273
+ state = run_to_completion (config , start_main_flow_event )
274
+ assert is_data_in_events (
275
+ state .outgoing_events ,
276
+ [
277
+ {
278
+ "type" : "StartUtteranceBotAction" ,
279
+ "script" : "This is a multiline\n string! 'Test' \" hi\" " ,
280
+ }
281
+ ],
282
+ )
283
+
284
+
258
285
def test_flow_return_values ():
259
286
"""Test flow return value handling."""
260
287
@@ -950,4 +977,4 @@ def test_expression_evaluation():
950
977
951
978
952
979
if __name__ == "__main__" :
953
- test_expression_evaluation ()
980
+ test_multiline_string ()
0 commit comments