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

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

Issue 24239010: Use symbol literals in the mirror tests. (Except for void, the empty string and setters.) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge line 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
« no previous file with comments | « tests/lib/mirrors/intercepted_cache_test.dart ('k') | tests/lib/mirrors/is_odd_test.dart » ('j') | 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 test.invoke_throws_test; 5 library test.invoke_throws_test;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 10
(...skipping 17 matching lines...) Expand all
28 static set staticSetter(v) { throw new MyException(); } 28 static set staticSetter(v) { throw new MyException(); }
29 static staticFunction() { throw new MyException(); } 29 static staticFunction() { throw new MyException(); }
30 } 30 }
31 31
32 get libraryGetter { throw new MyException(); } 32 get libraryGetter { throw new MyException(); }
33 set librarySetter(v) { throw new MyException(); } 33 set librarySetter(v) { throw new MyException(); }
34 libraryFunction() { throw new MyException(); } 34 libraryFunction() { throw new MyException(); }
35 35
36 main() { 36 main() {
37 InstanceMirror im = reflect(new Class.noException()); 37 InstanceMirror im = reflect(new Class.noException());
38 Expect.throws(() => im.getField(const Symbol('getter')), 38 Expect.throws(() => im.getField(#getter),
39 (e) => e is MyException); 39 (e) => e is MyException);
40 Expect.throws(() => im.setField(const Symbol('setter'), ['arg']), 40 Expect.throws(() => im.setField(#setter, ['arg']),
41 (e) => e is MyException); 41 (e) => e is MyException);
42 Expect.throws(() => im.invoke(const Symbol('method'), []), 42 Expect.throws(() => im.invoke(#method, []),
43 (e) => e is MyException); 43 (e) => e is MyException);
44 Expect.throws(() => im.invoke(const Symbol('triggerNoSuchMethod'), []), 44 Expect.throws(() => im.invoke(#triggerNoSuchMethod, []),
45 (e) => e is MyException); 45 (e) => e is MyException);
46 46
47 ClassMirror cm = reflectClass(Class); 47 ClassMirror cm = reflectClass(Class);
48 Expect.throws(() => cm.getField(const Symbol('staticGetter')), 48 Expect.throws(() => cm.getField(#staticGetter),
49 (e) => e is MyException); 49 (e) => e is MyException);
50 Expect.throws(() => cm.setField(const Symbol('staticSetter'), ['arg']), 50 Expect.throws(() => cm.setField(#staticSetter, ['arg']),
51 (e) => e is MyException); 51 (e) => e is MyException);
52 Expect.throws(() => cm.invoke(const Symbol('staticFunction'), []), 52 Expect.throws(() => cm.invoke(#staticFunction, []),
53 (e) => e is MyException); 53 (e) => e is MyException);
54 Expect.throws(() => cm.newInstance(const Symbol('generative'), []), 54 Expect.throws(() => cm.newInstance(#generative, []),
55 (e) => e is MyException); 55 (e) => e is MyException);
56 Expect.throws(() => cm.newInstance(const Symbol('redirecting'), []), 56 Expect.throws(() => cm.newInstance(#redirecting, []),
57 (e) => e is MyException); 57 (e) => e is MyException);
58 Expect.throws(() => cm.newInstance(const Symbol('faktory'), []), 58 Expect.throws(() => cm.newInstance(#faktory, []),
59 (e) => e is MyException); 59 (e) => e is MyException);
60 Expect.throws(() => cm.newInstance(const Symbol('redirectingFactory'), []), 60 Expect.throws(() => cm.newInstance(#redirectingFactory, []),
61 (e) => e is MyException); 61 (e) => e is MyException);
62 62
63 LibraryMirror lm = reflectClass(Class).owner; 63 LibraryMirror lm = reflectClass(Class).owner;
64 Expect.throws(() => lm.getField(const Symbol('libraryGetter')), 64 Expect.throws(() => lm.getField(#libraryGetter),
65 (e) => e is MyException); 65 (e) => e is MyException);
66 Expect.throws(() => lm.setField(const Symbol('librarySetter'), ['arg']), 66 Expect.throws(() => lm.setField(#librarySetter, ['arg']),
67 (e) => e is MyException); 67 (e) => e is MyException);
68 Expect.throws(() => lm.invoke(const Symbol('libraryFunction'), []), 68 Expect.throws(() => lm.invoke(#libraryFunction, []),
69 (e) => e is MyException); 69 (e) => e is MyException);
70 } 70 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/intercepted_cache_test.dart ('k') | tests/lib/mirrors/is_odd_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698