Пример #1
0
 /** The top level module has a valid name, but the inherited one does not. */
 public void testModuleNestedNamingInvalid() {
   UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
   builder.setLowestLogLevel(TreeLogger.ERROR);
   builder.expectError(
       "Invalid module name: 'com.google.gwt.dev.cfg.testdata.naming.Invalid..Foo'", null);
   UnitTestTreeLogger logger = builder.createLogger();
   try {
     ModuleDefLoader.loadFromClassPath(
         logger, compilerContext, "com.google.gwt.dev.cfg.testdata.naming.NestedInvalid", false);
     fail("Expected exception from invalid module name.");
   } catch (UnableToCompleteException expected) {
   }
   logger.assertLogEntriesContainExpected();
 }
Пример #2
0
 /**
  * Test that when compiling buggyCode, the TypeOracleUpdater emits expectedError somewhere in its
  * output. The code should define a class named Buggy.
  */
 private void shouldGenerateError(
     SourceLevel sourceLevel, CharSequence buggyCode, String... expectedErrors) {
   UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
   builder.setLowestLogLevel(TreeLogger.ERROR);
   if (expectedErrors != null) {
     builder.expectError("Errors in \'/mock/Buggy.java\'", null);
     for (String e : expectedErrors) {
       builder.expectError(e, null);
     }
   }
   UnitTestTreeLogger logger = builder.createLogger();
   StaticJavaResource buggyResource = new StaticJavaResource("Buggy", buggyCode);
   TypeOracleTestingUtils.buildStandardTypeOracleWith(
       logger,
       Collections.<Resource>emptySet(),
       CompilationStateTestBase.getGeneratedUnits(buggyResource),
       sourceLevel);
   logger.assertCorrectLogEntries();
 }