| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 46 | 46 | 
| 47     smoke.invoke(a, #inc2, []); | 47     smoke.invoke(a, #inc2, []); | 
| 48     expect(a.i, 37); | 48     expect(a.i, 37); | 
| 49     smoke.invoke(a, #inc2, [4]); | 49     smoke.invoke(a, #inc2, [4]); | 
| 50     expect(a.i, 41); | 50     expect(a.i, 41); | 
| 51 | 51 | 
| 52     expect(() => smoke.invoke(a, #inc1, [4, 5]), throws); | 52     expect(() => smoke.invoke(a, #inc1, [4, 5]), throws); | 
| 53     expect(a.i, 41); | 53     expect(a.i, 41); | 
| 54   }); | 54   }); | 
| 55 | 55 | 
|  | 56   test('static invoke', () { | 
|  | 57     A.staticValue = 42; | 
|  | 58     smoke.invoke(A, #staticInc, []); | 
|  | 59     expect(A.staticValue, 43); | 
|  | 60   }); | 
|  | 61 | 
| 56   test('read and invoke function', () { | 62   test('read and invoke function', () { | 
| 57     var a = new A(); | 63     var a = new A(); | 
| 58     expect(a.i, 42); | 64     expect(a.i, 42); | 
| 59     var f = smoke.read(a, #inc1); | 65     var f = smoke.read(a, #inc1); | 
| 60     f(4); | 66     f(4); | 
| 61     expect(a.i, 46); | 67     expect(a.i, 46); | 
| 62     Function.apply(f, [4]); | 68     Function.apply(f, [4]); | 
| 63     expect(a.i, 50); | 69     expect(a.i, 50); | 
| 64   }); | 70   }); | 
| 65 | 71 | 
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 298 } | 304 } | 
| 299 | 305 | 
| 300 class A { | 306 class A { | 
| 301   int i = 42; | 307   int i = 42; | 
| 302   int j = 44; | 308   int j = 44; | 
| 303   int get j2 => j; | 309   int get j2 => j; | 
| 304   void set j2(int v) { j = v; } | 310   void set j2(int v) { j = v; } | 
| 305   void inc0() { i++; } | 311   void inc0() { i++; } | 
| 306   void inc1(int v) { i = i + (v == null ? -10 : v); } | 312   void inc1(int v) { i = i + (v == null ? -10 : v); } | 
| 307   void inc2([int v]) { i = i + (v == null ? -10 : v); } | 313   void inc2([int v]) { i = i + (v == null ? -10 : v); } | 
|  | 314 | 
|  | 315   static int staticValue = 42; | 
|  | 316   static void staticInc() { staticValue++; } | 
|  | 317 | 
| 308 } | 318 } | 
| 309 | 319 | 
| 310 class B { | 320 class B { | 
| 311   final int f = 3; | 321   final int f = 3; | 
| 312   int _w; | 322   int _w; | 
| 313   int get w => _w; | 323   int get w => _w; | 
| 314   set w(int v) { _w = v; } | 324   set w(int v) { _w = v; } | 
| 315 | 325 | 
| 316   String z; | 326   String z; | 
| 317   A a; | 327   A a; | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 371   @a2 int d; | 381   @a2 int d; | 
| 372 } | 382 } | 
| 373 | 383 | 
| 374 class H extends G { | 384 class H extends G { | 
| 375   int e; | 385   int e; | 
| 376   @a1 int f; | 386   @a1 int f; | 
| 377   @a1 int g; | 387   @a1 int g; | 
| 378   @a2 int h; | 388   @a2 int h; | 
| 379   @a3 int i; | 389   @a3 int i; | 
| 380 } | 390 } | 
| OLD | NEW | 
|---|