Prepare test for AS side of VF2JS.

Signed-off-by: Erik de Bruin <e...@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/07f18205
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/07f18205
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/07f18205

Branch: refs/heads/experimental/VF2JS
Commit: 07f182051aa27bd8ae1963f449c9166892bc2348
Parents: 8913289
Author: Erik de Bruin <e...@ixsoftware.nl>
Authored: Tue Jul 1 11:18:37 2014 +0200
Committer: Jose Barragan <josebarra...@apache.org>
Committed: Thu Jul 10 18:03:30 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/07f18205/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/07f18205/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/07f18205/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

Reply via email to