| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Common test code that is run by 3 tests: mirrors_test.dart, | 5 /// Common test code that is run by 3 tests: mirrors_test.dart, |
| 6 /// mirrors_used_test.dart, and static_test.dart. | 6 /// mirrors_used_test.dart, and static_test.dart. |
| 7 library smoke.test.common; | 7 library smoke.test.common; |
| 8 | 8 |
| 9 import 'package:smoke/smoke.dart' as smoke; | 9 import 'package:smoke/smoke.dart' as smoke; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 }); | 295 }); |
| 296 | 296 |
| 297 test('symbol to name', () { | 297 test('symbol to name', () { |
| 298 expect(smoke.symbolToName(#i), 'i'); | 298 expect(smoke.symbolToName(#i), 'i'); |
| 299 }); | 299 }); |
| 300 | 300 |
| 301 test('name to symbol', () { | 301 test('name to symbol', () { |
| 302 expect(smoke.nameToSymbol('i'), #i); | 302 expect(smoke.nameToSymbol('i'), #i); |
| 303 }); | 303 }); |
| 304 }); | 304 }); |
| 305 |
| 306 test('invoke Type instance methods', () { |
| 307 var a = new A(); |
| 308 expect(smoke.invoke(a.runtimeType, #toString, []), 'A'); |
| 309 }); |
| 305 } | 310 } |
| 306 | 311 |
| 307 class A { | 312 class A { |
| 308 int i = 42; | 313 int i = 42; |
| 309 int j = 44; | 314 int j = 44; |
| 310 int get j2 => j; | 315 int get j2 => j; |
| 311 void set j2(int v) { j = v; } | 316 void set j2(int v) { j = v; } |
| 312 void inc0() { i++; } | 317 void inc0() { i++; } |
| 313 void inc1(int v) { i = i + (v == null ? -10 : v); } | 318 void inc1(int v) { i = i + (v == null ? -10 : v); } |
| 314 void inc2([int v]) { i = i + (v == null ? -10 : v); } | 319 void inc2([int v]) { i = i + (v == null ? -10 : v); } |
| 315 | 320 |
| 316 static int staticValue = 42; | 321 static int staticValue = 42; |
| 317 static void staticInc() { staticValue++; } | 322 static void staticInc() { staticValue++; } |
| 318 | |
| 319 } | 323 } |
| 320 | 324 |
| 321 class B { | 325 class B { |
| 322 final int f = 3; | 326 final int f = 3; |
| 323 int _w; | 327 int _w; |
| 324 int get w => _w; | 328 int get w => _w; |
| 325 set w(int v) { _w = v; } | 329 set w(int v) { _w = v; } |
| 326 | 330 |
| 327 String z; | 331 String z; |
| 328 A a; | 332 A a; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 @a1 int f; | 392 @a1 int f; |
| 389 @a1 int g; | 393 @a1 int g; |
| 390 @a2 int h; | 394 @a2 int h; |
| 391 @a3 int i; | 395 @a3 int i; |
| 392 } | 396 } |
| 393 | 397 |
| 394 class K { | 398 class K { |
| 395 @AnnotC(named: true) int k; | 399 @AnnotC(named: true) int k; |
| 396 @AnnotC() int k2; | 400 @AnnotC() int k2; |
| 397 } | 401 } |
| OLD | NEW |