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

Side by Side Diff: dart/tests/corelib/symbol_test.dart

Issue 14142003: Add Symbol class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
kasperl 2013/04/11 10:48:58 2013
ahe 2013/04/11 11:26:06 Done.
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 notString() => const Symbol(0);
6
7 notIdentifier() => const Symbol('0');
8
9 privateIdentifier() => const Symbol('_');
10
11 main() {
12 var x;
13 print(x = const Symbol('fisk'));
14
15 try {
16 print(notString()); /// 01: compile-time error
17 } on ArgumentError {
18 print('Caught ArgumentError');
19 } on TypeError {
20 print('Caught TypeError');
21 }
22
23 try {
24 print(notIdentifier()); /// 02: compile-time error
25 } on ArgumentError catch (e) {
26 print('Caught $e');
27 }
28
29 try {
30 print(privateIdentifier()); /// 03: compile-time error
31 } on ArgumentError catch (e) {
32 print('Caught $e');
33 }
34
35 try {
36 print(new Symbol(0));
37 throw 'Expected an ArgumentError or a TypeError';
38 } on ArgumentError {
39 print('Caught ArgumentError');
40 } on TypeError {
41 print('Caught TypeError');
42 }
43
44 try {
45 print(new Symbol('0'));
46 throw 'Expected an ArgumentError';
47 } on ArgumentError catch (e) {
48 print('Caught $e');
49 }
50
51 try {
52 print(new Symbol('_'));
53 throw 'Expected an ArgumentError';
54 } on ArgumentError catch (e) {
55 print('Caught $e');
56 }
57
58 print(identical(const Symbol('fisk'), x));
59 }
OLDNEW
« dart/sdk/lib/core/symbol.dart ('K') | « dart/tests/corelib/corelib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698