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

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

Issue 21511003: Support symbol literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 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) 2013, 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 // Test symbol literals.
6
7 library symbol_literal_test;
8
9 import 'package:expect/expect.dart';
10
11 foo(a, b) => Expect.isTrue(identical(a, b));
12
13 var check = foo; // Indirection used to avoid inlining.
14
15 main() {
16 check(const Symbol("a"), #a);
17 check(const Symbol("a"), #
18 a);
19 check(const Symbol("ab"), #ab);
20 check(const Symbol("ab"), #
21 ab);
22 check(const Symbol("a.b"), #a.b);
23 check(const Symbol("a.b"), #
24 a
25 .
26 b);
27 check(const Symbol("=="), #==);
28 check(const Symbol("=="), # ==);
29 check(const Symbol("a.toString"), #a.toString);
30
31 // Tries to call the symbol literal #a.toString
32 Expect.throws(() => #a.toString(), (e) => e is NoSuchMethodError); /// 01: sta tic type warning
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698