Skip to content

Commit

Permalink
Refactor CompilerTestCase to use classes objects to describe the parts.
Browse files Browse the repository at this point in the history
This makes it possible to support "one-off" cases without confusing overloads.

This change doesn't yet cover all test variants (module inputs, checking extern changes) which would allow additional variants to be removed, nor does it attempt to remove the cleanup of removing the less common variants of test/testSame/etc which would ultimately be the goal.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158400843
  • Loading branch information
concavelenz authored and brad4d committed Jun 9, 2017
1 parent 3617803 commit 6954648
Show file tree
Hide file tree
Showing 65 changed files with 1,169 additions and 1,209 deletions.
38 changes: 17 additions & 21 deletions test/com/google/javascript/jscomp/AggressiveInlineAliasesTest.java
Expand Up @@ -47,27 +47,23 @@ protected void setUp() throws Exception {
}

public void test_b19179602() {
test(
LINE_JOINER.join(
"var a = {};",
"/** @constructor */ a.b = function() {};",
"a.b.staticProp = 5;",
"/** @constructor */",
"function f() { ",
" while (true) { ",
" var b = a.b;",
" alert(b.staticProp); } }"),
LINE_JOINER.join(
"var a = {};",
"/** @constructor */ a.b = function() {};",
"a.b.staticProp = 5;",
"/** @constructor */",
"function f() {",
" for(; true; ) {",
" var b = a.b;",
" alert(b.staticProp); } }"),
null,
AggressiveInlineAliases.UNSAFE_CTOR_ALIASING);
test(LINE_JOINER.join(
"var a = {};",
"/** @constructor */ a.b = function() {};",
"a.b.staticProp = 5;",
"/** @constructor */",
"function f() { ",
" while (true) { ",
" var b = a.b;",
" alert(b.staticProp); } }"), LINE_JOINER.join(
"var a = {};",
"/** @constructor */ a.b = function() {};",
"a.b.staticProp = 5;",
"/** @constructor */",
"function f() {",
" for(; true; ) {",
" var b = a.b;",
" alert(b.staticProp); } }"), warning(AggressiveInlineAliases.UNSAFE_CTOR_ALIASING));
}

public void test_b19179602_declareOutsideLoop() {
Expand Down
Expand Up @@ -447,7 +447,7 @@ public void testSetPropertyOfGlobalThis() {
}

public void testReadPropertyOfGlobalThis() {
testSame("Object.prototype.prop;", "f(this.prop);", null);
testSame("Object.prototype.prop;", "f(this.prop);");
}

public void testSetQuotedPropertyOfThis() {
Expand Down

0 comments on commit 6954648

Please sign in to comment.