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

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

Issue 12743005: Revert "Remove Expect from core library." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload (first upload failed). Created 7 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
« no previous file with comments | « tests/language/const_nested_test.dart ('k') | tests/language/const_string_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // Check that const objects (including literals) are immutable. 4 // Check that const objects (including literals) are immutable.
5 5
6 import "package:expect/expect.dart";
7
8 class A { 6 class A {
9 const A(this.x, this.y); 7 const A(this.x, this.y);
10 final num x, y; 8 final num x, y;
11 } 9 }
12 10
13 main() { 11 main() {
14 var list = const [1, 2]; 12 var list = const [1, 2];
15 Expect.throws(() => list[0] = 3); 13 Expect.throws(() => list[0] = 3);
16 Expect.equals(1, list[0]); 14 Expect.equals(1, list[0]);
17 15
18 var m = const { 'foo': 499 }; 16 var m = const { 'foo': 499 };
19 Expect.throws(() => m['foo'] = 42); 17 Expect.throws(() => m['foo'] = 42);
20 Expect.equals(499, m['foo']); 18 Expect.equals(499, m['foo']);
21 19
22 var a1 = const A(1, 2); 20 var a1 = const A(1, 2);
23 Expect.throws(() => a1.x = 499); 21 Expect.throws(() => a1.x = 499);
24 Expect.equals(1, a1.x); 22 Expect.equals(1, a1.x);
25 23
26 A a2 = const A(1, 2); 24 A a2 = const A(1, 2);
27 Expect.throws(() => a2.x = 499); 25 Expect.throws(() => a2.x = 499);
28 Expect.equals(1, a2.x); 26 Expect.equals(1, a2.x);
29 } 27 }
OLDNEW
« no previous file with comments | « tests/language/const_nested_test.dart ('k') | tests/language/const_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698