flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From josebarra...@apache.org
Subject [16/26] git commit: [flex-falcon] [refs/heads/experimental/VF2JS] - Prepare test for AS side of VF2JS.
Date Wed, 09 Jul 2014 23:39:12 GMT
Prepare test for AS side of VF2JS.

Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/7fbdbb8a
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/7fbdbb8a
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/7fbdbb8a

Branch: refs/heads/experimental/VF2JS
Commit: 7fbdbb8a2d11251b2dc5e15551c9aeead8fb1805
Parents: 36fa654
Author: Erik de Bruin <erik@ixsoftware.nl>
Authored: Tue Jul 1 11:18:37 2014 +0200
Committer: Jose Barragan <josebarragan@apache.org>
Committed: Thu Jul 10 01:33:44 2014 +0200

----------------------------------------------------------------------
 .../codegen/js/vf2js/TestVF2JSFile.java         | 61 ++++++++++++++++++++
 .../test-files/vf2js/files/SimpleAS.as          | 39 +++++++++++++
 .../test-files/vf2js/files/SimpleAS_result.js   | 47 +++++++++++++++
 3 files changed, 147 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7fbdbb8a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
new file mode 100644
index 0000000..5de3ecc
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
@@ -0,0 +1,61 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.vf2js;
+
+import java.io.File;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.test.VF2JSTestBase;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid 'goog' JS code from an external
+ * file.
+ * 
+ * @author Erik de Bruin
+ */
+public class TestVF2JSFile extends VF2JSTestBase
+{
+    @Test
+    public void testSimple()
+    {
+        String fileName = "SimpleAS";
+
+        IFileNode node = compileAS(fileName, true,
+                "test-files"
+                        + File.separator + "vf2js" + File.separator + "files",
+                false);
+        
+        asBlockWalker.visitFile(node);
+        
+        writeResultToFile(writer.toString(), fileName);
+        
+        assertOut(getCodeFromFile(fileName + "_result", true,
+                "vf2js" + File.separator + "files"));
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new FlexJSBackend();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7fbdbb8a/compiler.jx.tests/test-files/vf2js/files/SimpleAS.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/files/SimpleAS.as b/compiler.jx.tests/test-files/vf2js/files/SimpleAS.as
new file mode 100644
index 0000000..fd9baf3
--- /dev/null
+++ b/compiler.jx.tests/test-files/vf2js/files/SimpleAS.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex
+{
+
+import flash.events.IEventDispatcher;
+
+import spark.components.Button;
+
+public dynamic class A extends spark.components.Button implements IEventDispatcher
+{
+	public static const MY_CLASS_CONST:String = "myClassConst";
+	
+	public function A()
+	{
+		trace(typeof "a");
+	}
+	
+	private var _a:ArgumentError = new ArgumentError();
+
+	public const MY_INSTANCE_CONST:String = "myInstanceConst";
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7fbdbb8a/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js b/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js
new file mode 100644
index 0000000..e6ef05a
--- /dev/null
+++ b/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js
@@ -0,0 +1,47 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+goog.provide('org.apache.flex.A');
+
+goog.require('flash.events.IEventDispatcher');
+goog.require('spark.components.Button');
+
+/**
+ * @constructor
+ * @extends {spark.components.Button}
+ * @implements {flash.events.IEventDispatcher}
+ */
+org.apache.flex.A = function() {
+	var self = this;
+	goog.base(this);
+	self.trace(typeof("a"));
+}
+goog.inherits(org.apache.flex.A, spark.components.Button);
+
+/**
+ * @const
+ * @type {string}
+ */
+org.apache.flex.A.MY_CLASS_CONST = "myClassConst";
+
+/**
+ * @private
+ * @type {ArgumentError}
+ */
+org.apache.flex.A.prototype._a = new ArgumentError();
+
+/**
+ * @const
+ * @type {string}
+ */
+org.apache.flex.A.prototype.MY_INSTANCE_CONST = "myInstanceConst";
\ No newline at end of file


Mime
View raw message