third_party/closure-compiler/src/test/com/google/javascript/jscomp/IntegrationTest.java
/**
   * Tests that calls to goog.string.Const.from() with non-constant arguments are detected with and
   * without collapsed properties, even when goog.string.Const.from has been aliased.
   */
Tests that calls to goog.string.Const.from() with non-constant arguments are detected with and
without collapsed properties, even when goog.string.Const.from has been aliased.
Tests that calls to goog . string . Const . from () with non - constant arguments are detected with and without collapsed properties even when goog . string . Const . from has been aliased .
@Test
  public void testBug22684459_aliased() {
    String source =
        ""
            + "var goog = {};"
            + "goog.string = {};"
            + "goog.string.Const = {};"
            + "goog.string.Const.from = function(x) {};"
            + "var mkConst = goog.string.Const.from;"
            + "var x = window.document.location;"
            + "mkConst(x);";
    CompilerOptions options = createCompilerOptions();
    test(options, source, ConstParamCheck.CONST_NOT_STRING_LITERAL_ERROR);
    options.setCollapsePropertiesLevel(PropertyCollapseLevel.ALL);
    test(options, source, ConstParamCheck.CONST_NOT_STRING_LITERAL_ERROR);
  }
@ Test public void testBug22684459_aliased ( ) { String source = "" + "var goog = {};" + "goog.string = {};" + "goog.string.Const = {};" + "goog.string.Const.from = function(x) {};" + "var mkConst = goog.string.Const.from;" + "var x = window.document.location;" + "mkConst(x);" ; CompilerOptions options = createCompilerOptions ( ) ; test ( options , source , ConstParamCheck . CONST_NOT_STRING_LITERAL_ERROR ) ; options . setCollapsePropertiesLevel ( PropertyCollapseLevel . ALL ) ; test ( options , source , ConstParamCheck . CONST_NOT_STRING_LITERAL_ERROR ) ; }
Tests that calls to goog.string.Const.from() with non-constant arguments are detected with and
 without collapsed properties, even when goog.string.Const.from has been aliased.
Tests that calls to goog . string . Const . from () with non - constant arguments are detected with and without collapsed properties even when goog . string . Const . from has been aliased .
// Without collapsed properties. // With collapsed properties.