public void testCharSetExpansion() {
   testSame("");
   assertEquals("US-ASCII", lastCompiler.getOptions().outputCharset);
   args.add("--charset=UTF-8");
   testSame("");
   assertEquals("UTF-8", lastCompiler.getOptions().outputCharset);
 }
 public void testSourceMapFormat2() {
   args.add("--js_output_file");
   args.add("/path/to/out.js");
   args.add("--source_map_format=V3");
   testSame("var x = 3;");
   assertEquals(SourceMap.Format.V3, lastCompiler.getOptions().sourceMapFormat);
 }
 public void testSourceMapExpansion2() {
   useModules = ModulePattern.CHAIN;
   args.add("--create_source_map=%outname%.map");
   args.add("--module_output_path_prefix=foo");
   testSame(new String[] {"var x = 3;", "var y = 5;"});
   assertEquals(
       "foo.map", lastCommandLineRunner.expandSourceMapPath(lastCompiler.getOptions(), null));
 }
 public void testSourceMapExpansion1() {
   args.add("--js_output_file");
   args.add("/path/to/out.js");
   args.add("--create_source_map=%outname%.map");
   testSame("var x = 3;");
   assertEquals(
       "/path/to/out.js.map",
       lastCommandLineRunner.expandSourceMapPath(lastCompiler.getOptions(), null));
 }
  private void assertSortedInputs(List<SourceFile> expected, List<SourceFile> shuffled)
      throws Exception {
    Compiler compiler = new Compiler(System.err);
    compiler.initCompilerOptionsIfTesting();
    compiler.getOptions().setProcessCommonJSModules(true);
    compiler
        .getOptions()
        .dependencyOptions
        .setEntryPoints(ImmutableList.of(ES6ModuleLoader.toModuleName(URI.create("a"))));
    compiler.compile(
        ImmutableList.of(SourceFile.fromCode("externs.js", "")), shuffled, compiler.getOptions());

    List<SourceFile> result = new ArrayList<>();
    for (JSModule m : compiler.getModuleGraph().getAllModules()) {
      for (CompilerInput i : m.getInputs()) {
        result.add(i.getSourceFile());
      }
    }

    assertEquals(expected, result);
  }