From 5ef774f6abc127f84d1fdadda0b94ba211b49363 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 1 Apr 2022 22:09:53 +0200 Subject: [PATCH] fcl-js: do not escape / (cherry picked from commit 410c1bbaa0211b56076ede5ec0b2c9605c5cba62) --- packages/fcl-js/src/jswriter.pp | 3 +-- packages/fcl-js/tests/tcwriter.pp | 2 +- packages/pastojs/tests/tcmodules.pas | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/fcl-js/src/jswriter.pp b/packages/fcl-js/src/jswriter.pp index b20f268e34..ca054a7920 100644 --- a/packages/fcl-js/src/jswriter.pp +++ b/packages/fcl-js/src/jswriter.pp @@ -590,13 +590,12 @@ begin While I<=L do begin c:=S[I]; - if (c in [#0..#31,'"','''','/','\']) + if (c in [#0..#31,'"','''','\']) or (c>=#$ff00) or ((c>=#$D800) and (c<=#$DFFF)) then begin R:=R+Copy(S,J,I-J); Case c of '\' : R:=R+'\\'; - '/' : R:=R+'\/'; '"' : if Quote=jseqSingle then R:=R+'"' else R:=R+'\"'; '''': if Quote=jseqDouble then R:=R+'''' else R:=R+'\'''; #0..#7,#11,#14..#31: R:=R+'\x'+TJSString(hexStr(ord(c),2)); diff --git a/packages/fcl-js/tests/tcwriter.pp b/packages/fcl-js/tests/tcwriter.pp index 1d2250ac56..c8bd4ae1af 100644 --- a/packages/fcl-js/tests/tcwriter.pp +++ b/packages/fcl-js/tests/tcwriter.pp @@ -2638,7 +2638,7 @@ Var begin L:=TJSLiteral.Create(0,0,''); L.Value.AsString:='ab/cd'; - AssertWrite('ab/cd','"ab\/cd"',L); + AssertWrite('ab/cd','"ab/cd"',L); end; Procedure TTestLiteralWriter.TestStringsBack; diff --git a/packages/pastojs/tests/tcmodules.pas b/packages/pastojs/tests/tcmodules.pas index 7c46e6a93b..52849b9198 100644 --- a/packages/pastojs/tests/tcmodules.pas +++ b/packages/pastojs/tests/tcmodules.pas @@ -493,7 +493,7 @@ type Procedure TestArray_SetLengthMultiDim; Procedure TestArray_SetLengthDynOfStatic; Procedure TestArray_OpenArrayOfString; - Procedure TestArray_ArrayOfCharAssignString; // ToDo + Procedure TestArray_ArrayOfCharAssignString; Procedure TestArray_ConstRef; Procedure TestArray_Concat; Procedure TestArray_Copy; @@ -961,8 +961,6 @@ type Procedure TestLibrary_Export_Index_Fail; Procedure TestLibrary_ExportVar; Procedure TestLibrary_ExportUnitFunc; - // ToDo: test delayed specialization init - // ToDo: shortrefoptimization end; function LinesToStr(Args: array of const): string; @@ -7247,6 +7245,7 @@ end; procedure TTestModule.TestSet_AnonymousEnumTypeChar; begin exit; + StartProgram(false); Add([ 'type', @@ -8649,7 +8648,7 @@ begin ' s:=concat(s,''a'',s);', ' s:=#250#269;', ' i:=low(s)+high(a);', - //' s:=#$2F804;', + ' s:=''a/b'';', // ToDo: \uD87E\uDC04 -> \u{2F804} '']); ConvertProgram; @@ -8684,6 +8683,7 @@ begin '$mod.s = $mod.s.concat("a", $mod.s);', '$mod.s = "úč";', '$mod.i = 1 + $mod.a.length;', + '$mod.s = "a/b";', ''])); end;