Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2700)

Unified Diff: test/cctest/test-parsing.cc

Issue 2554363002: [parsing] Add some more tests of maybe-assigned. (Closed)
Patch Set: format^2 Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index d2b96649735e9af5d5974108c82a87dc7701c20d..f862225db2e4afe9a1bbef40f23457f3215c1c5f 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -3261,35 +3261,45 @@ TEST(InnerAssignment) {
const char* prefix = "function f() {";
const char* midfix = " function g() {";
const char* suffix = "}}; f";
- struct { const char* source; bool assigned; bool strict; } outers[] = {
- // Actual assignments.
- { "var x; var x = 5;", true, false },
- { "var x; { var x = 5; }", true, false },
- { "'use strict'; let x; x = 6;", true, true },
- { "var x = 5; function x() {}", true, false },
- // Actual non-assignments.
- { "var x;", false, false },
- { "var x = 5;", false, false },
- { "'use strict'; let x;", false, true },
- { "'use strict'; let x = 6;", false, true },
- { "'use strict'; var x = 0; { let x = 6; }", false, true },
- { "'use strict'; var x = 0; { let x; x = 6; }", false, true },
- { "'use strict'; let x = 0; { let x = 6; }", false, true },
- { "'use strict'; let x = 0; { let x; x = 6; }", false, true },
- { "var x; try {} catch (x) { x = 5; }", false, false },
- { "function x() {}", false, false },
- // Eval approximation.
- { "var x; eval('');", true, false },
- { "eval(''); var x;", true, false },
- { "'use strict'; let x; eval('');", true, true },
- { "'use strict'; eval(''); let x;", true, true },
- // Non-assignments not recognized, because the analysis is approximative.
- { "var x; var x;", true, false },
- { "var x = 5; var x;", true, false },
- { "var x; { var x; }", true, false },
- { "var x; function x() {}", true, false },
- { "function x() {}; var x;", true, false },
- { "var x; try {} catch (x) { var x = 5; }", true, false },
+ struct {
+ const char* source;
+ bool assigned;
+ bool strict;
+ } outers[] = {
+ // Actual assignments.
+ {"var x; var x = 5;", true, false},
+ {"var x; { var x = 5; }", true, false},
+ {"'use strict'; let x; x = 6;", true, true},
+ {"var x = 5; function x() {}", true, false},
+ {"var x = 4; var x = 5;", true, false},
+ {"var [x, x] = [4, 5];", true, false},
+ {"var {a: x, b: x} = {a: 4, b: 5};", true, false},
+ {"var x = {a: 4, b: (x = 5)};", true, false},
+ {"var {x=1} = {a: 4, b: (x = 5)};", true, false},
+ {"var {x} = {x: 4, b: (x = 5)};", true, false},
+ // Actual non-assignments.
+ {"var x;", false, false},
+ {"var x = 5;", false, false},
+ {"'use strict'; let x;", false, true},
+ {"'use strict'; let x = 6;", false, true},
+ {"'use strict'; var x = 0; { let x = 6; }", false, true},
+ {"'use strict'; var x = 0; { let x; x = 6; }", false, true},
+ {"'use strict'; let x = 0; { let x = 6; }", false, true},
+ {"'use strict'; let x = 0; { let x; x = 6; }", false, true},
+ {"var x; try {} catch (x) { x = 5; }", false, false},
+ {"function x() {}", false, false},
+ // Eval approximation.
+ {"var x; eval('');", true, false},
+ {"eval(''); var x;", true, false},
+ {"'use strict'; let x; eval('');", true, true},
+ {"'use strict'; eval(''); let x;", true, true},
+ // Non-assignments not recognized, because the analysis is approximative.
+ {"var x; var x;", true, false},
+ {"var x = 5; var x;", true, false},
+ {"var x; { var x; }", true, false},
+ {"var x; function x() {}", true, false},
+ {"function x() {}; var x;", true, false},
+ {"var x; try {} catch (x) { var x = 5; }", true, false},
};
struct { const char* source; bool assigned; bool with; } inners[] = {
// Actual assignments.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698