From 875150cb1ff816e33e4d30c83948afe404d47725 Mon Sep 17 00:00:00 2001 From: Anton Trunov Date: Sat, 28 Dec 2024 16:25:08 +0400 Subject: [PATCH] fix: string literals generator must generate escaped strings --- src/test/utils/expression/randomAst.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/utils/expression/randomAst.ts b/src/test/utils/expression/randomAst.ts index a24ce79b7..b9936629a 100644 --- a/src/test/utils/expression/randomAst.ts +++ b/src/test/utils/expression/randomAst.ts @@ -36,10 +36,13 @@ export function randomAstBoolean(): fc.Arbitrary { } export function randomAstString(): fc.Arbitrary { + const escapeString = (s: string): string => + s.replace("\\", "\\\\").replace('"', '\\"'); + return dummyAstNode( fc.record({ kind: fc.constant("string"), - value: fc.string(), + value: fc.string().map((s) => escapeString(s)), }), ); }