Browse Source

[python] fix tuple creation

Dan Korostelev 11 years ago
parent
commit
ed80aa4073
2 changed files with 8 additions and 1 deletions
  1. 1 1
      genpy.ml
  2. 7 0
      tests/unit/TestPython.hx

+ 1 - 1
genpy.ml

@@ -1468,7 +1468,7 @@ module Printer = struct
 				Printf.sprintf "%s(%s)" (print_expr pctx e1) (print_exprs pctx ", " el)
 			| "python_Syntax.field",[e1;{eexpr = TConst(TString id)}] ->
 				Printf.sprintf "%s.%s" (print_expr pctx e1) id
-			| "python_Syntax.tuple", [{eexpr = TArrayDecl el}] ->
+			| "python_Syntax._tuple", [{eexpr = TArrayDecl el}] ->
 				Printf.sprintf "(%s)" (print_exprs pctx ", " el)
 			| "python_Syntax._arrayAccess", e1 :: {eexpr = TArrayDecl el} :: etrail ->
 				let trailing_colon = match etrail with

+ 7 - 0
tests/unit/TestPython.hx

@@ -329,6 +329,13 @@ class TestPython extends Test {
 		eq("2", test4b(1));
 	}
 
+	function testTupleCreation() {
+		var t = Tup2.create(1, 2);
+		eq(t._1, 1);
+		eq(t._2, 2);
+		eq(t.length, 2);
+	}
+
 	function testExtern()
 	{
 		eq(new ExternClass().f(1), 2);