Browse Source

fcl-js: test var a=1,b=2,c=3

git-svn-id: trunk@37766 -
Mattias Gaertner 7 years ago
parent
commit
a8f18c29fb
1 changed files with 28 additions and 0 deletions
  1. 28 0
      packages/fcl-js/tests/tcwriter.pp

+ 28 - 0
packages/fcl-js/tests/tcwriter.pp

@@ -99,6 +99,7 @@ type
     Procedure TestVarDeclarationStatement;
     Procedure TestVarListDeclarationStatement;
     Procedure TestVarListDeclarationStatement2Vars;
+    Procedure TestVarListDeclarationStatement3Vars;
     Procedure TestReturnStatement;
     Procedure TestLabeledStatement;
     Procedure TestLabeledStatementCompact;
@@ -957,6 +958,33 @@ begin
   AssertWrite('simple 2 vars','var a, b',S);
 end;
 
+procedure TTestStatementWriter.TestVarListDeclarationStatement3Vars;
+Var
+  S : TJSVariableStatement;
+  V : TJSVarDeclaration;
+  L : TJSVariableDeclarationList;
+
+begin
+  S:=TJSVariableStatement.Create(0,0);
+  L:=TJSVariableDeclarationList.Create(0,0);
+  S.A:=L;
+  V:=TJSVarDeclaration.Create(0,0);
+  L.A:=V;
+  V.Name:='a';
+  V.Init:=CreateLiteral(1);
+  L.B:=TJSVariableDeclarationList.Create(0,0);
+  L:=TJSVariableDeclarationList(L.B);
+  V:=TJSVarDeclaration.Create(0,0);
+  L.A:=V;
+  V.Name:='b';
+  V.Init:=CreateLiteral(2);
+  V:=TJSVarDeclaration.Create(0,0);
+  L.B:=V;
+  V.Name:='c';
+  V.Init:=CreateLiteral(3);
+  AssertWrite('simple 3 vars','var a = 1, b = 2, c = 3',S);
+end;
+
 procedure TTestStatementWriter.TestReturnStatement;
 Var
   S : TJSReturnStatement;