test/com/google/javascript/jscomp/deps/DepsGeneratorTest.java
/**
   * Ensures that everything still works when both a deps.js and a deps-runfiles.js file are
   * included. Also uses real files.
   */
Ensures that everything still works when both a deps.js and a deps-runfiles.js file are
included. Also uses real files.
Ensures that everything still works when both a deps . js and a deps - runfiles . js file are included . Also uses real files .
@Test
  public void testDepsAsSrcs() throws Exception {
    final SourceFile depsFile1 =
        SourceFile.fromCode(
            "/base/deps1.js",
            LINE_JOINER.join(
                "// Test deps file 1.",
                "",
                "goog.addDependency('../prescanned1/file1.js', ['dep.string'], []);",
                "goog.addDependency('../prescanned1/file2.js', [], []);",
                "// Test that this appears only once in the output. It's also defined in deps2.js",
                "goog.addDependency('../this/is/defined/thrice.js', [], []);",
                "goog.addDependency('../this/is/defined/thrice.js', [], []);",
                ""));
    final SourceFile depsFile2 =
        SourceFile.fromCode(
            "/base/deps2.js",
            LINE_JOINER.join(
                "// Test deps file 2.",
                "",
                "goog.addDependency("
                    + "'../prescanned2/file1.js', ['dep.bool', 'dep.number'], ['dep.string']);",
                "goog.addDependency('../prescanned2/file2.js', [], []);",
                "goog.addDependency('../prescanned2/generated.js', ['dep.generated'], []);",
                "goog.addDependency('../this/is/defined/thrice.js', [], []);",
                ""));
    DepsGenerator depsGenerator =
        new DepsGenerator(
            ImmutableList.of(depsFile1),
            ImmutableList.of(depsFile2),
            DepsGenerator.InclusionStrategy.ALWAYS,
            PathUtil.makeAbsolute("/base/javascript/closure"),
            errorManager,
            new ModuleLoader(
                null,
                ImmutableList.of("/base/" + "/"),
                ImmutableList.of(),
                BrowserModuleResolver.FACTORY,
                ModuleLoader.PathResolver.ABSOLUTE));
    String output = depsGenerator.computeDependencyCalls();
    assertWithMessage("There should be output").that(output).isNotEmpty();
    assertNoWarnings();
  }
@ Test public void testDepsAsSrcs ( ) throws Exception { final SourceFile depsFile1 = SourceFile . fromCode ( "/base/deps1.js" , LINE_JOINER . join ( "// Test deps file 1." , "" , "goog.addDependency('../prescanned1/file1.js', ['dep.string'], []);" , "goog.addDependency('../prescanned1/file2.js', [], []);" , "// Test that this appears only once in the output. It's also defined in deps2.js" , "goog.addDependency('../this/is/defined/thrice.js', [], []);" , "goog.addDependency('../this/is/defined/thrice.js', [], []);" , "" ) ) ; final SourceFile depsFile2 = SourceFile . fromCode ( "/base/deps2.js" , LINE_JOINER . join ( "// Test deps file 2." , "" , "goog.addDependency(" + "'../prescanned2/file1.js', ['dep.bool', 'dep.number'], ['dep.string']);" , "goog.addDependency('../prescanned2/file2.js', [], []);" , "goog.addDependency('../prescanned2/generated.js', ['dep.generated'], []);" , "goog.addDependency('../this/is/defined/thrice.js', [], []);" , "" ) ) ; DepsGenerator depsGenerator = new DepsGenerator ( ImmutableList . of ( depsFile1 ) , ImmutableList . of ( depsFile2 ) , DepsGenerator . InclusionStrategy . ALWAYS , PathUtil . makeAbsolute ( "/base/javascript/closure" ) , errorManager , new ModuleLoader ( null , ImmutableList . of ( "/base/" + "/" ) , ImmutableList . of ( ) , BrowserModuleResolver . FACTORY , ModuleLoader . PathResolver . ABSOLUTE ) ) ; String output = depsGenerator . computeDependencyCalls ( ) ; assertWithMessage ( "There should be output" ) . that ( output ) . isNotEmpty ( ) ; assertNoWarnings ( ) ; }
Ensures that everything still works when both a deps.js and a deps-runfiles.js file are
 included.
Ensures that everything still works when both a deps . js and a deps - runfiles . js file are included .