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

Side by Side Diff: tests/lib/mirrors/symbol_validation_test.dart

Issue 24631003: Add proper API for creating private symbols wrt a library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: maintain dart2js coverage Created 7 years, 2 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/lib/mirrors/private_symbol_test.dart ('k') | no next file » | 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) 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 library symbol_validation_test;
6
7 import 'dart:mirrors';
8 import 'package:expect/expect.dart';
9
10 validSymbol(String string) {
11 Expect.equals(string,
12 MirrorSystem.getName(new Symbol(string)),
13 'Valid symbol "$string" should be invertable');
14 Expect.equals(string,
15 MirrorSystem.getName(MirrorSystem.getSymbol(string)),
16 'Valid symbol "$string" should be invertable');
17 }
18
19 invalidSymbol(String string) {
20 Expect.throws(() => new Symbol(string),
21 (e) => e is ArgumentError,
22 'Invalid symbol "$string" should be rejected');
23 Expect.throws(() => MirrorSystem.getSymbol(string),
24 (e) => e is ArgumentError,
25 'Invalid symbol "$string" should be rejected');
26 }
27
28 main() {
29 ['%', '&', '*', '+', '-', '/', '<', '<<', '<=', '==', '>',
30 '>=', '>>', '[]', '[]=', '^', 'unary-', '|', '~', '~/']
31 .forEach(validSymbol);
32
33 ['foo', '_bar', 'baz.quz', 'fisk1', 'hest2fisk', 'a.b.c.d.e',
34 '\$', 'foo\$', 'bar\$bar']
35 .forEach(validSymbol);
36
37 ['6', '0foo', ',', 'S with M', '_invalid&private']
38 .forEach(invalidSymbol);
39 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/private_symbol_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698