Explorar o código

pastojs: fixed test on windows

mattias %!s(int64=2) %!d(string=hai) anos
pai
achega
322503678d

+ 3 - 2
packages/pastojs/tests/tcmodules.pas

@@ -32,6 +32,7 @@ const
   // default parser+scanner options
   po_tcmodules = po_Pas2js+[po_KeepScannerError];
   co_tcmodules = [];
+  JSONNewLine = {$IFDEF Windows}'\r\n'{$ELSE}'\n'{$ENDIF};
 type
   TSrcMarkerKind = (
     mkLabel,
@@ -8877,11 +8878,11 @@ begin
   CheckSource('TestStringConst_Multiline',
     LinesToStr([
     'this.a = "";',
-    'this.b = "\nline";',
+    'this.b = "'+JSONNewLine+'line";',
     'this.c = "Single";',
     'this.d = "`";',
     'this.e = "abc`xyz";',
-    'this.f = "first''line\n       second''line\n";',
+    'this.f = "first''line'+JSONNewLine+'       second''line\n";',
     '']),
     LinesToStr([
     ]));

+ 4 - 4
packages/pastojs/tests/tcunitsearch.pas

@@ -877,7 +877,7 @@ begin
   AddUnit('unit1.pas',
   ['var a: longint;'],
   ['']);
-  AddUnit('sub/unit1.pas',
+  AddUnit('sub'+PathDelim+'unit1.pas',
   ['var b: longint;'],
   ['']);
   AddFile('test1.pas',[
@@ -887,7 +887,7 @@ begin
     '  a:=b;',
     'end.']);
   Compile(['test1.pas','-Jc'],ExitCodeSyntaxError);
-  AssertEquals('ErrorMsg','Duplicate file found: "'+WorkDir+'sub/unit1.pas" and "'+WorkDir+'unit1.pas"',ErrorMsg);
+  AssertEquals('ErrorMsg','Duplicate file found: "'+WorkDir+'sub'+PathDelim+'unit1.pas" and "'+WorkDir+'unit1.pas"',ErrorMsg);
 end;
 
 procedure TTestCLI_UnitSearch.TestUS_UsesInFile_IndirectDuplicate;
@@ -897,7 +897,7 @@ begin
   AddUnit('unit1.pas',
   ['var a: longint;'],
   ['']);
-  AddUnit('sub/unit1.pas',
+  AddUnit('sub'+PathDelim+'unit1.pas',
   ['var b: longint;'],
   ['']);
   AddUnit('unit2.pas',
@@ -908,7 +908,7 @@ begin
     'begin',
     'end.']);
   Compile(['test1.pas','-Jc'],ExitCodeSyntaxError);
-  AssertEquals('ErrorMsg','Duplicate file found: "'+WorkDir+'unit1.pas" and "'+WorkDir+'sub/unit1.pas"',ErrorMsg);
+  AssertEquals('ErrorMsg','Duplicate file found: "'+WorkDir+'unit1.pas" and "'+WorkDir+'sub'+PathDelim+'unit1.pas"',ErrorMsg);
 end;
 
 procedure TTestCLI_UnitSearch.TestUS_UsesInFile_WorkNotEqProgDir;