Skip to content

Commit

Permalink
Add a test of an odd pattern that shows up in Angular.
Browse files Browse the repository at this point in the history
One of my upcoming CLs currently produces an error for this pattern, so having this test in place will make it easier to fix that CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143497109
  • Loading branch information
tbreisacher authored and blickly committed Jan 4, 2017
1 parent e3b16bf commit 9138fde
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/com/google/javascript/jscomp/VariableReferenceCheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ public void setUp() throws Exception {
enableUnusedLocalAssignmentCheck = false;
}

public void testDoubleTryCatch() {
testSame(
LINE_JOINER.join(
"function g() {",
" return f;",
"",
" function f() {",
" try {",
" } catch (e) {",
" alert(e);",
" }",
" try {",
" } catch (e) {",
" alert(e);",
" }",
" }",
"}"));
}

public void testCorrectCode() {
assertNoWarning("function foo(d) { (function() { d.foo(); }); d.bar(); } ");
assertNoWarning("function foo() { bar(); } function bar() { foo(); } ");
Expand Down

0 comments on commit 9138fde

Please sign in to comment.