Chromium Code Reviews| Index: tests/corelib/symbol_reserved_word_test.dart |
| diff --git a/tests/corelib/symbol_reserved_word_test.dart b/tests/corelib/symbol_reserved_word_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0729fbd838ccb937d5e62435f8c0d35556ae9e77 |
| --- /dev/null |
| +++ b/tests/corelib/symbol_reserved_word_test.dart |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +main() { |
| + var x; |
| + |
| + // 'void' is allowed as a symbol name. |
| + x = const Symbol('void'); /// 01: ok |
| + |
| + // However, it is not allowed as a part of a symbol name. |
| + x = const Symbol('void.foo'); /// 02: compile-time error |
| + x = const Symbol('foo.void'); /// 03: compile-time error |
| + |
| + // All other reserved words are disallowed. |
| + x = const Symbol('assert'); /// 04: compile-time error |
| + x = const Symbol('break'); /// 05: compile-time error |
|
Lasse Reichstein Nielsen
2014/07/23 20:52:35
I wouldn't mind just using '04: continued' here an
Paul Berry
2014/07/24 21:40:47
Done.
ahe
2014/08/04 14:28:05
That means you won't be testing each case. We don'
|
| + x = const Symbol('case'); /// 06: compile-time error |
| + x = const Symbol('catch'); /// 07: compile-time error |
| + x = const Symbol('class'); /// 08: compile-time error |
| + x = const Symbol('const'); /// 09: compile-time error |
| + x = const Symbol('continue'); /// 10: compile-time error |
| + x = const Symbol('default'); /// 11: compile-time error |
| + x = const Symbol('do'); /// 12: compile-time error |
| + x = const Symbol('else'); /// 13: compile-time error |
| + x = const Symbol('enum'); /// 14: compile-time error |
| + x = const Symbol('extends'); /// 15: compile-time error |
| + x = const Symbol('false'); /// 16: compile-time error |
| + x = const Symbol('final'); /// 17: compile-time error |
| + x = const Symbol('finally'); /// 18: compile-time error |
| + x = const Symbol('for'); /// 19: compile-time error |
| + x = const Symbol('if'); /// 20: compile-time error |
| + x = const Symbol('in'); /// 21: compile-time error |
| + x = const Symbol('is'); /// 22: compile-time error |
| + x = const Symbol('new'); /// 23: compile-time error |
| + x = const Symbol('null'); /// 24: compile-time error |
| + x = const Symbol('rethrow'); /// 25: compile-time error |
| + x = const Symbol('return'); /// 26: compile-time error |
| + x = const Symbol('super'); /// 27: compile-time error |
| + x = const Symbol('switch'); /// 28: compile-time error |
| + x = const Symbol('this'); /// 29: compile-time error |
| + x = const Symbol('throw'); /// 30: compile-time error |
| + x = const Symbol('true'); /// 31: compile-time error |
| + x = const Symbol('try'); /// 32: compile-time error |
| + x = const Symbol('var'); /// 33: compile-time error |
| + x = const Symbol('while'); /// 34: compile-time error |
| + x = const Symbol('with'); /// 35: compile-time error |
| +} |
|
Lasse Reichstein Nielsen
2014/07/23 20:52:35
Consider also testing "new Symbol(...)" and "#..."
Paul Berry
2014/07/24 21:40:47
Done.
|