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

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

Issue 1014023002: Add tests for constants from deferred loaded libraries being readable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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) 2015, 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 // Dart version of two-argument Ackermann-Peter function.
5
6 library deferred_load_constants;
7
8 import "package:expect/expect.dart";
9 import "package:async_helper/async_helper.dart";
10 import "deferred_load_constants.dart" deferred as foo;
11 import "deferred_load_constants.dart";
12
13 main() {
14 asyncStart();
15 Expect.throws(() => foo.c);
16 Expect.throws(() => foo.C);
17 Expect.throws(() => foo.funtype);
18 Expect.throws(() => foo.toplevel);
19 foo.loadLibrary().whenComplete(() {
20 // Reading constant declarations through deferred prefix works.
21 Expect.identical(c, foo.c);
22 Expect.identical(C, foo.C);
23 Expect.identical(funtype, foo.funtype);
24 Expect.identical(toplevel, foo.toplevel);
25 Expect.identical(C.staticfun, foo.C.staticfun);
26 // Access through deferred prefix is not a constant expression.
27 Expect.throws(() => const [foo.c]); /// 01: compile-time error
28 Expect.throws(() => const [foo.C]); /// 02: compile-time error
29 Expect.throws(() => const [foo.funtype]); /// 03: compile-time error
30 Expect.throws(() => const [foo.toplevel]); /// 04: compile-time error
31 Expect.throws(() => const [foo.C.staticfun]); /// 05: compile-time error
32
33 asyncEnd();
34 });
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698