anchor.diff:        // Collect any other files we've imported.
         var files = new Set<String>();
         _collectTransitiveImports(contents, files, from: testFile);
  -      var moduleName =
  -          path.withoutExtension(path.relative(testFile, from: codegenTestDir));
  -      var unit = new BuildUnit(moduleName, path.dirname(testFile),
  -          files.toList(), _moduleForLibrary);
  +      var unit = new BuildUnit(
  +          name, path.dirname(testFile), files.toList(), _moduleForLibrary);
         var module = compiler.compile(unit, options);
  -      _writeModule(
  -          path.join(outDir, path.basenameWithoutExtension(testFile)),
  -          path.join(expectDir, path.basenameWithoutExtension(testFile)),
  -          module);
  +      _writeModule(path.join(codegenOutputDir, name),
  +          isTopLevelTest ? path.join(codegenExpectDir, name) : null, module);
       });
     }
   
  
positive.code:       new File(mapPath)
            .writeAsStringSync(JSON.encode(result.placeSourceMap(mapPath)));
      }
  
      expectFile.writeAsStringSync(result.code);
  
      // There are no errors, so delete any stale ".err" file.
      if (errorFile.existsSync()) {
  
negative.code:     var relativePath = path.relative(testFile, from: codegenTestDir);
  
      // Only compile the top-level files for generating coverage.
      bool isTopLevelTest = path.dirname(relativePath) == ".";
      if (codeCoverage && !isTopLevelTest) continue;
  
      var name = path.withoutExtension(relativePath);
      test('dartdevc $name', () {
        // Check if we need to use special compile options.
        var contents = new File(testFile).readAsStringSync();
        var match =
  