You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2014/08/01 13:00:49 UTC
[28/33] git commit: [flex-falcon] [refs/heads/develop] - Initial
(MXML) project test.
Initial (MXML) project test.
Signed-off-by: Erik de Bruin <er...@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/1baa5947
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1baa5947
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1baa5947
Branch: refs/heads/develop
Commit: 1baa5947423d7b260a74c509d3f7ce1afd96674f
Parents: f6f606f
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Jul 2 16:13:12 2014 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Aug 1 12:59:16 2014 +0200
----------------------------------------------------------------------
.../codegen/js/vf2js/TestVF2JSProject.java | 93 ++++++++++++++++++++
1 file changed, 93 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1baa5947/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
new file mode 100644
index 0000000..2e534c1
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
@@ -0,0 +1,93 @@
+/*
+ *
+ * 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 static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.internal.test.VF2JSTestBase;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid 'vf2js' JS code from an external
+ * project.
+ *
+ * @author Erik de Bruin
+ */
+public class TestVF2JSProject extends VF2JSTestBase
+{
+
+ private static String projectDirPath = "vf2js/projects";
+
+ @Override
+ public void setUp()
+ {
+ project = new FlexJSProject(workspace);
+ super.setUp();
+ }
+
+ @Test
+ public void testSimpleMXMLProject()
+ {
+ String testDirPath = projectDirPath + "/simpleMXML";
+
+ String fileName = "SimpleMXML";
+
+ List<String> compiledFileNames = compileProject(fileName, testDirPath);
+
+ assertProjectOut(compiledFileNames, testDirPath);
+ }
+
+ @Override
+ protected IBackend createBackend()
+ {
+ return new MXMLFlexJSBackend();
+ }
+
+ protected void assertProjectOut(List<String> compiledFileNames,
+ String testDirPath)
+ {
+ for (String compiledFileName : compiledFileNames)
+ {
+ String compiledFilePath = tempDir.getAbsolutePath()
+ + File.separator + testDirPath + File.separator
+ + compiledFileName + "_output" + "."
+ + backend.getOutputExtension();
+ String compiledResult = readCodeFile(new File(compiledFilePath));
+
+ //System.out.println(compiledResult);
+
+ String expectedFilePath = new File("test-files").getAbsolutePath()
+ + File.separator + testDirPath + File.separator
+ + compiledFileName + "_result" + "."
+ + backend.getOutputExtension();
+ String expectedResult = readCodeFile(new File(expectedFilePath));
+
+ assertThat(compiledResult, is(expectedResult));
+ }
+ }
+
+}