/**
  * Generates a list of modules from a list of inputs. Does not generate any dependencies between
  * the modules.
  */
 static JSModule[] createModules(String... inputs) {
   JSModule[] modules = new JSModule[inputs.length];
   for (int i = 0; i < inputs.length; i++) {
     JSModule module = modules[i] = new JSModule("m" + i);
     module.add(SourceFile.fromCode("i" + i, inputs[i]));
   }
   return modules;
 }
  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);
  }