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

Side by Side Diff: tests/language/lazy_final3_test.dart

Issue 10909081: Fix tests and update status files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 file.
4
5 final x = foo();
6 var x2 = foo2();
7 var x3 = foo3();
8 var x4 = foo4();
9 var x5 = foo5();
10 final x6 = foo6();
11 var x7 = x7 + 1;
12
13 foo() { throw "interrupt initialization"; }
14 foo2() { x2 = 499; throw "interrupt initialization"; }
15 foo3() => x3 + 1;
16 foo4() {
17 x4 = 498;
18 x4 = x4 + 1;
19 return x4;
20 }
21 foo5() {
22 x5 = 498;
23 x5 = x5 + 1;
24 }
25 foo6() {
26 try {
27 return x5 + 1;
28 } catch (e) {
29 return 499;
30 }
31 }
32
33 fib(x) {
34 if (x is! int) return 0;
35 if (x < 2) return x;
36 return fib(x - 1) + fib(x - 2);
37 }
38
39 main() {
40 Expect.throws(() => fib(x), (e) => e == "interrupt initialization");
41 Expect.equals(null, x);
42
43 Expect.throws(() => fib(x2), (e) => e == "interrupt initialization");
44 Expect.equals(499, x2);
45
46 Expect.throws(() => fib(x3), (e) => e is RuntimeError);
47 Expect.equals(null, x3);
48
49 Expect.equals(499, x4);
50
51 Expect.equals(null, x5);
52
53 Expect.equals(499, x6);
54
55 Expect.throws(() => fib(x7), (e) => e is RuntimeError);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698