diff --git a/test/com/google/javascript/jscomp/IntegrationTestCase.java b/test/com/google/javascript/jscomp/IntegrationTestCase.java index 148e08b2369..a83b78400b8 100644 --- a/test/com/google/javascript/jscomp/IntegrationTestCase.java +++ b/test/com/google/javascript/jscomp/IntegrationTestCase.java @@ -35,116 +35,120 @@ abstract class IntegrationTestCase extends TestCase { protected static final Joiner LINE_JOINER = Joiner.on('\n'); /** Externs for the test */ - protected static final List DEFAULT_EXTERNS = - ImmutableList.of(SourceFile.fromCode("externs", LINE_JOINER.join( - "var arguments;", - "var undefined;", - "var Math;", - "var isNaN;", - "var Infinity;", - "/** @interface */", - "var Iterator = function() {};", - "/** @interface */", - "var Iterable = function() {};", - "/** @interface @extends {Iterator} @extends {Iterable} */", - "var IteratorIterable = function() {};", - "/** @interface */", - "function IArrayLike() {};", - // TODO(sdh): See if we can remove IIterableResult and Set once polyfills are split - "/** @interface */", - "var IIterableResult = function() {};", - "/** @constructor */", - "var Map;", - "/** @constructor */", - "var Set;", - "/** @constructor */", - "function ObjectPropertyDescriptor() {};", - "", - "/** @constructor */ function Window() {}", - "/** @type {string} */ Window.prototype.name;", - "/** @type {string} */ Window.prototype.offsetWidth;", - "/** @type {Window} */ var window;", - "", - "/** @nosideeffects */ function noSideEffects() {}", - "", - "/**", - " * @constructor", - " * @nosideeffects", - " */", - "function Widget() {}", - "/** @modifies {this} */ Widget.prototype.go = function() {};", - "/** @return {string} */ var widgetToken = function() {};", - "", - "function alert(message) {}", - "", - "/**", - " * @constructor", - " * @implements {IArrayLike}", - " * @return {!Array}", - " * @param {...*} var_args", - " */", - "function Array(var_args) {}", - "", - "/**", - " * @constructor", - " * @return {number}", - " * @param {*=} opt_n", - " */", - "function Number(opt_n) {}", - "", - "/**", - " * @constructor", - " * @return {string}", - " * @param {*=} opt_s", - " */", - "function String(opt_s) {}", - "", - "/**", - " * @constructor", - " * @return {boolean}", - " * @param {*=} opt_b", - " */", - "function Boolean(opt_b) {}", - "", - "/**", - " * @constructor", - " * @return {!TypeError}", - " * @param {*=} opt_message", - " * @param {*=} opt_file", - " * @param {*=} opt_line", - " */", - "function TypeError(opt_message, opt_file, opt_line) {}", - "", - "/**", - " * @constructor", - " * @param {*=} opt_value", - " * @return {!Object}", - " */", - "function Object(opt_value) {}", - "Object.seal;", - "Object.defineProperties;", - "/** @type {!Function} */", - "Object.prototype.constructor;", - "", - "/** @typedef {?} */", - "var symbol;", - "", - "/**", - " * @param {string} s", - " * @return {symbol}", - " */", - "function Symbol(s) {}", - "", - "/**", - " * @param {...*} var_args", - " * @constructor", - " */", - "function Function(var_args) {}", - "/** @param {...*} var_args */", - "Function.prototype.call = function (var_args) {};", - "", - "/** @constructor */", - "function Arguments() {}"))); + protected static final ImmutableList DEFAULT_EXTERNS = + ImmutableList.of( + SourceFile.fromCode( + "externs", + LINE_JOINER.join( + "var arguments;", + "var undefined;", + "var Math;", + "var isNaN;", + "var Infinity;", + "/** @interface */", + "var Iterator = function() {};", + "/** @interface */", + "var Iterable = function() {};", + "/** @interface @extends {Iterator} @extends {Iterable} */", + "var IteratorIterable = function() {};", + "/** @interface */", + "function IArrayLike() {};", + // TODO(sdh): See if we can remove IIterableResult and Set once polyfills are + // split + "/** @interface */", + "var IIterableResult = function() {};", + "/** @constructor */", + "var Map;", + "/** @constructor */", + "var Set;", + "/** @constructor */", + "function ObjectPropertyDescriptor() {};", + "", + "/** @constructor */ function Window() {}", + "/** @type {string} */ Window.prototype.name;", + "/** @type {string} */ Window.prototype.offsetWidth;", + "/** @type {Window} */ var window;", + "", + "/** @nosideeffects */ function noSideEffects() {}", + "", + "/**", + " * @constructor", + " * @nosideeffects", + " */", + "function Widget() {}", + "/** @modifies {this} */ Widget.prototype.go = function() {};", + "/** @return {string} */ var widgetToken = function() {};", + "", + "function alert(message) {}", + "", + "/**", + " * @constructor", + " * @implements {IArrayLike}", + " * @return {!Array}", + " * @param {...*} var_args", + " */", + "function Array(var_args) {}", + "", + "/**", + " * @constructor", + " * @return {number}", + " * @param {*=} opt_n", + " */", + "function Number(opt_n) {}", + "", + "/**", + " * @constructor", + " * @return {string}", + " * @param {*=} opt_s", + " */", + "function String(opt_s) {}", + "", + "/**", + " * @constructor", + " * @return {boolean}", + " * @param {*=} opt_b", + " */", + "function Boolean(opt_b) {}", + "", + "/**", + " * @constructor", + " * @return {!TypeError}", + " * @param {*=} opt_message", + " * @param {*=} opt_file", + " * @param {*=} opt_line", + " */", + "function TypeError(opt_message, opt_file, opt_line) {}", + "", + "/**", + " * @constructor", + " * @param {*=} opt_value", + " * @return {!Object}", + " */", + "function Object(opt_value) {}", + "Object.seal;", + "Object.defineProperties;", + "/** @type {!Function} */", + "Object.prototype.constructor;", + "", + "/** @typedef {?} */", + "var symbol;", + "", + "/**", + " * @param {string} s", + " * @return {symbol}", + " */", + "function Symbol(s) {}", + "", + "/**", + " * @param {...*} var_args", + " * @constructor", + " */", + "function Function(var_args) {}", + "/** @param {...*} var_args */", + "Function.prototype.call = function (var_args) {};", + "", + "/** @constructor */", + "function Arguments() {}"))); protected List externs = DEFAULT_EXTERNS; diff --git a/test/com/google/javascript/jscomp/PeepholeFoldConstantsTest.java b/test/com/google/javascript/jscomp/PeepholeFoldConstantsTest.java index 07e3ec767b5..e9f005bbedd 100644 --- a/test/com/google/javascript/jscomp/PeepholeFoldConstantsTest.java +++ b/test/com/google/javascript/jscomp/PeepholeFoldConstantsTest.java @@ -1330,7 +1330,7 @@ public void foldDefineProperties1() { testSame("Object.defineProperties(a, {anything:1})"); } - private static final List LITERAL_OPERANDS = + private static final ImmutableList LITERAL_OPERANDS = ImmutableList.of( "null", "undefined",