OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 | 4 |
5 // Test symbol literals. | 5 // Test symbol literals. |
6 | 6 |
7 library symbol_literal_test; | 7 library symbol_literal_test; |
8 | 8 |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 check(const Symbol("=="), #==); | 35 check(const Symbol("=="), #==); |
36 check(const Symbol("=="), # ==); | 36 check(const Symbol("=="), # ==); |
37 check(const Symbol("a.toString"), #a.toString); | 37 check(const Symbol("a.toString"), #a.toString); |
38 | 38 |
39 Expect.equals(1, testSwitch(#abc)); | 39 Expect.equals(1, testSwitch(#abc)); |
40 | 40 |
41 const m = const <Symbol, int>{#A:0, #B:1}; | 41 const m = const <Symbol, int>{#A:0, #B:1}; |
42 Expect.equals(1, m[#B]); | 42 Expect.equals(1, m[#B]); |
43 | 43 |
44 // Tries to call the symbol literal #a.toString | 44 // Tries to call the symbol literal #a.toString |
45 Expect.throws(() => #a.toString(), (e) => e is NoSuchMethodError); /// 01: sta
tic type warning | 45 Expect.throws(() => #a.toString(), (e) => e is NoSuchMethodError); //# 01: sta
tic type warning |
46 } | 46 } |
OLD | NEW |