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

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

Issue 232563006: Insert checks before deferred calls and accesses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Correct update to co19 Created 6 years, 8 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
« no previous file with comments | « tests/language/deferred_not_loaded_check_lib.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 import 'package:expect/expect.dart';
6 import 'package:async_helper/async_helper.dart';
7
8 import "deferred_not_loaded_check_lib.dart" deferred as lib;
9
10 // Test that we give appropriate errors when accessing an element that is not
11 // yet loaded.
12
13 var c;
14
15 expectNoSideEffect(test) {
16 c = 0;
17 test();
18 Expect.isTrue(c == 0);
19 }
20
21 expectThrowsNotLoaded(test){
22 Expect.throws(test, (e) => e is Error);
23 }
24
25 int sideEffect() {
26 c = 1;
27 return 10;
28 }
29
30 void main() {
31 expectNoSideEffect(() {
32 expectThrowsNotLoaded(() {
33 lib.foo(sideEffect());
34 });
35 });
36 expectNoSideEffect(() {
37 expectThrowsNotLoaded(() {
38 lib.C.foo(sideEffect());
39 });
40 });
41 expectNoSideEffect(() {
42 expectThrowsNotLoaded(() {
43 new lib.C(sideEffect());
44 });
45 });
46 expectThrowsNotLoaded(() {
47 lib.a;
48 });
49 expectNoSideEffect(() {
50 expectThrowsNotLoaded(() {
51 lib.a = sideEffect();
52 });
53 });
54 expectThrowsNotLoaded(() {
55 lib.getter;
56 });
57 expectNoSideEffect(() {
58 expectThrowsNotLoaded(() {
59 lib.setter = sideEffect();
60 });
61 });
62 expectNoSideEffect(() {
63 expectThrowsNotLoaded(() {
64 lib.list[sideEffect()] = sideEffect();
65 });
66 });
67 expectNoSideEffect(() {
68 expectThrowsNotLoaded(() {
69 lib.closure(sideEffect());
70 });
71 });
72 }
OLDNEW
« no previous file with comments | « tests/language/deferred_not_loaded_check_lib.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698