You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/03/27 16:09:10 UTC

git commit: [flex-falcon] [refs/heads/develop] - - Continued making the Unit-Tests use the TestAdapters

Repository: flex-falcon
Updated Branches:
  refs/heads/develop 80e344aa5 -> 2741581a5


- Continued making the Unit-Tests use the TestAdapters


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

Branch: refs/heads/develop
Commit: 2741581a5a7394b5c0a3c87b77301fd30f893026
Parents: 80e344a
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Sun Mar 27 16:08:58 2016 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Sun Mar 27 16:08:58 2016 +0200

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSProject.java    | 25 ++++++++++----------
 .../codegen/js/goog/TestGoogProject.java        |  4 ++--
 .../flex/compiler/internal/test/TestBase.java   | 15 ++++++++----
 3 files changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2741581a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
index b20d8f5..fec0d2f 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import junit.framework.Assert;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.exceptions.ConfigurationException;
 import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogProject;
@@ -139,8 +140,7 @@ public class TestFlexJSProject extends TestGoogProject
         try {
 			((FlexJSProject)project).config.setCompilerAllowSubclassOverrides(null, true);
 		} catch (ConfigurationException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+            Assert.fail(e.getMessage());
 		}
         project.setTargetSettings(new TargetSettings(((FlexJSProject)project).config));
         
@@ -163,8 +163,7 @@ public class TestFlexJSProject extends TestGoogProject
         try {
 			((FlexJSProject)project).config.setCompilerAllowSubclassOverrides(null, true);
 		} catch (ConfigurationException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+            Assert.fail(e.getMessage());
 		}
         project.setTargetSettings(new TargetSettings(((FlexJSProject)project).config));
         
@@ -176,15 +175,15 @@ public class TestFlexJSProject extends TestGoogProject
 
         String out = sb.toString();
         out = out.replace("\\", "/");
-        
-        String expected = "test-files/flexjs/projects/bad_overrides/Test.as(31:29)\n" +
-        					"interface method someFunction in interface IA is implemented with an incompatible signature in class Test\n" +
-        					"test-files/flexjs/projects/bad_overrides/Test.as(36:26)\n" +
-        					"interface method someOtherFunction in interface IA is implemented with an incompatible signature in class Test\n" +
-        					"test-files/flexjs/projects/bad_overrides/Test.as(31:29)\n" +
-        					"Incompatible override.\n" +
-        					"test-files/flexjs/projects/bad_overrides/Test.as(36:26)\n" +
-        					"Incompatible override.\n";
+
+        String expected = testAdapter.getUnitTestBaseDir().getPath() + "/flexjs/projects/bad_overrides/Test.as(31:29)\n" +
+                "interface method someFunction in interface IA is implemented with an incompatible signature in class Test\n" +
+                testAdapter.getUnitTestBaseDir().getPath() + "/flexjs/projects/bad_overrides/Test.as(36:26)\n" +
+                "interface method someOtherFunction in interface IA is implemented with an incompatible signature in class Test\n" +
+                testAdapter.getUnitTestBaseDir().getPath() + "/flexjs/projects/bad_overrides/Test.as(31:29)\n" +
+                "Incompatible override.\n" +
+                testAdapter.getUnitTestBaseDir().getPath() + "/flexjs/projects/bad_overrides/Test.as(36:26)\n" +
+                "Incompatible override.\n";
         assertThat(out, is(expected));
     }
     

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2741581a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
index c79e967..a120ec0 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
@@ -30,6 +30,7 @@ import java.util.List;
 
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
 
 /**
  * This class tests the production of valid 'goog' JS code from an external
@@ -74,8 +75,7 @@ public class TestGoogProject extends ASTestBase
     {
     	if (compiledFileNames.size() == 0)
     	{
-    		assertThat("No Compiled files", is("Compiled Files"));
-    		return;
+            fail("Expected compiled files");
     	}
         for (String compiledFileName : compiledFileNames)
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2741581a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
index d51e7ec..186f690 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
@@ -64,6 +64,7 @@ import org.apache.flex.utils.EnvProperties;
 import org.apache.flex.compiler.visitor.as.IASBlockWalker;
 import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
 import org.apache.flex.utils.FilenameNormalization;
+import org.apache.flex.utils.ITestAdapter;
 import org.apache.flex.utils.TestAdapterFactory;
 import org.junit.After;
 import org.junit.Before;
@@ -75,6 +76,8 @@ import com.google.common.collect.Iterables;
 @Ignore
 public class TestBase implements ITestBase
 {
+    private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter();
+
     protected List<ICompilerProblem> errors;
 
     protected static EnvProperties env = EnvProperties.initiate();
@@ -283,11 +286,13 @@ public class TestBase implements ITestBase
         	for (ICompilerProblem error : errors)
         	{
         		String fn = error.getSourcePath();
-        		int c = fn.indexOf("test-files");
-        		fn = fn.substring(c);
-        		sb.append(fn);
-        		sb.append("(" + error.getLine() + ":" + error.getColumn() + ")\n");
-        		sb.append(error.toString() + "\n");
+                if(fn != null) {
+                    int c = fn.indexOf(testAdapter.getUnitTestBaseDir().getPath());
+                    fn = fn.substring(c);
+                    sb.append(fn);
+                    sb.append("(" + error.getLine() + ":" + error.getColumn() + ")\n");
+                    sb.append(error.toString() + "\n");
+                }
         	}
         	System.out.println(sb.toString());
         	return compiledFileNames;