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

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

Issue 140643006: Update documentation on Symbol. Make validation match. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
« sdk/lib/internal/symbol.dart ('K') | « sdk/lib/internal/symbol.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
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 library symbol_validation_test; 5 library symbol_validation_test;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 validSymbol(String string) { 10 validSymbol(String string) {
(...skipping 18 matching lines...) Expand all
29 ['%', '&', '*', '+', '-', '/', '<', '<<', '<=', '==', '>', 29 ['%', '&', '*', '+', '-', '/', '<', '<<', '<=', '==', '>',
30 '>=', '>>', '[]', '[]=', '^', 'unary-', '|', '~', '~/'] 30 '>=', '>>', '[]', '[]=', '^', 'unary-', '|', '~', '~/']
31 .forEach(validSymbol); 31 .forEach(validSymbol);
32 32
33 ['foo', '_bar', 'baz.quz', 'fisk1', 'hest2fisk', 'a.b.c.d.e', 33 ['foo', '_bar', 'baz.quz', 'fisk1', 'hest2fisk', 'a.b.c.d.e',
34 '\$', 'foo\$', 'bar\$bar'] 34 '\$', 'foo\$', 'bar\$bar']
35 .forEach(validSymbol); 35 .forEach(validSymbol);
36 36
37 ['6', '0foo', ',', 'S with M', '_invalid&private'] 37 ['6', '0foo', ',', 'S with M', '_invalid&private']
38 .forEach(invalidSymbol); 38 .forEach(invalidSymbol);
39
40 // Reserved words are not valid identifiers and therefore not valid symbols.
41 var reservedWords = [
42 "assert",
43 "break",
44 "case",
45 "catch",
46 "class",
47 "const",
48 "continue",
49 "default",
50 "do",
51 "else",
52 "enum",
53 "extends",
54 "false",
55 "final",
56 "finally",
57 "for",
58 "if",
59 "in",
60 "is",
61 "new",
62 "null",
63 "rethrow",
64 "return",
65 "super",
66 "switch",
67 "this",
68 "throw",
69 "true",
70 "try",
71 "var",
72 "void",
73 "while",
74 "with"
75 ];
76 reservedWords.expand((w) => [w, "$w=", "x.$w" , "$w.x", "x.$w.x"])
77 .forEach(invalidSymbol);
39 } 78 }
79
80
OLDNEW
« sdk/lib/internal/symbol.dart ('K') | « sdk/lib/internal/symbol.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698