Skip to content

Commit

Permalink
Fix tests that use testSame() instead of test()
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174366779
  • Loading branch information
tbreisacher authored and brad4d committed Nov 3, 2017
1 parent 641e5d0 commit 25f231b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/com/google/javascript/jscomp/OptimizeParameters.java
Expand Up @@ -557,7 +557,7 @@ private static boolean adjustForSideEffects(List<Parameter> parameters) {

boolean anyMovable = false;
boolean seenUnmovableSideEffects = false;
boolean seenUnmoveableSideEfffected = false;
boolean seenUnmoveableSideEffected = false;
for (int i = parameters.size() - 1; i >= 0; i--) {
Parameter current = parameters.get(i);

Expand All @@ -569,15 +569,15 @@ private static boolean adjustForSideEffects(List<Parameter> parameters) {

if (current.shouldRemove
&& ((seenUnmovableSideEffects && current.canBeSideEffected())
|| (seenUnmoveableSideEfffected && current.hasSideEffects()))) {
|| (seenUnmoveableSideEffected && current.hasSideEffects()))) {
current.shouldRemove = false;
}

if (current.shouldRemove) {
anyMovable = true;
} else {
if (current.canBeSideEffected) {
seenUnmoveableSideEfffected = true;
seenUnmoveableSideEffected = true;
}

if (current.hasSideEffects) {
Expand Down
14 changes: 6 additions & 8 deletions test/com/google/javascript/jscomp/OptimizeParametersTest.java
Expand Up @@ -163,13 +163,13 @@ public void testDoOptimizeCall() {
testSame("var foo = function () {}; foo.call();");

testSame("var foo = function () {}; foo.call(this);");
testSame(
test(
"var foo = function (a) {}; foo.call(this, 1);",
"var foo = function () {var a$jscomp$1 = 1;}; foo.call(this);");
"var foo = function () {var a = 1;}; foo.call(this);");
testSame("var foo = function () {}; foo.call(null);");
testSame(
test(
"var foo = function (a) {}; foo.call(null, 1);",
"var foo = function () {var a$jscomp$1 = 1;}; foo.call(null);");
"var foo = function () {var a = 1;}; foo.call(null);");
}

public void testDoOptimizeApply() {
Expand Down Expand Up @@ -445,11 +445,9 @@ public void testApplyIsIgnore() {
}

public void testFunctionWithReferenceToArgumentsShouldNotBeOptimize() {
testSame("function foo(a,b,c) { return arguments.size; };" +
"foo(1);");
testSame("function foo(a,b,c) { return arguments.size; }; foo(1);");
testSame("var foo = function(a,b,c) { return arguments.size }; foo(1);");
testSame("var foo = function bar(a,b,c) { return arguments.size }; " +
"foo(2); bar(2);");
testSame("var foo = function bar(a,b,c) { return arguments.size }; foo(2); bar(2);");
}

public void testFunctionWithTwoNames() {
Expand Down

0 comments on commit 25f231b

Please sign in to comment.