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

Side by Side Diff: pkg/kernel/testcases/closures/static_tear_off.dart

Issue 2561723003: Merge kernel closure conversion into the Dart SDK (Closed)
Patch Set: Remove path constraint 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file.
4
5 f_1_1_no_default(a, [b]) => a + b;
6
7 f_1_1_default(a, [b = 2]) => a + b;
8
9 f_1_b_no_default(a, {b}) => a + b;
10
11 f_1_b_default(a, {b: 2}) => a + b;
12
13 test_1_1(Function f, bool hasDefault) {
14 var result = f(40, 2);
15 if (42 != result) throw "Unexpected result: $result";
16 test_1(f, hasDefault);
17 }
18
19 test_1_b(Function f, bool hasDefault) {
20 var result = f(40, b: 2);
21 if (42 != result) throw "Unexpected result: $result";
22 test_1(f, hasDefault);
23 }
24
25 test_1(Function f, bool hasDefault) {
26 var result = 0;
27 bool threw = true;
28 try {
29 result = f(40);
30 threw = false;
31 } catch (_) {
32 // Ignored.
33 }
34 if (hasDefault) {
35 if (threw) throw "Unexpected exception.";
36 if (42 != result) throw "Unexpected result: $result.";
37 } else {
38 if (!threw) throw "Expected exception missing.";
39 if (0 != result) throw "Unexpected result: $result.";
40 }
41 }
42
43 main(arguments) {
44 test_1_1(f_1_1_no_default, false);
45 test_1_1(f_1_1_default, true);
46 test_1_b(f_1_b_no_default, false);
47 test_1_b(f_1_b_default, true);
48 }
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/closures/non_void_context.dart.expect ('k') | pkg/kernel/testcases/closures/static_tear_off.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698