/**
  * Verifies that the compiler pass's JS output is the same as the input.
  *
  * @param modules Module inputs
  * @param warning A warning, or null for no expected warning.
  */
 public void testSame(JSModule[] modules, DiagnosticType warning) {
   try {
     String[] expected = new String[modules.length];
     for (int i = 0; i < modules.length; i++) {
       expected[i] = "";
       for (CompilerInput input : modules[i].getInputs()) {
         expected[i] += input.getSourceFile().getCode();
       }
     }
     test(modules, expected, null, warning);
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
  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);
  }