| 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 // Unit test of the [NativeBehavior.processSpecString] method. | 5 // Unit test of the [NativeBehavior.processSpecString] method. |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'package:compiler/src/native/native.dart'; | 8 import 'package:compiler/src/native/native.dart'; |
| 9 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 9 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 10 import 'package:compiler/src/diagnostics/messages.dart'; | 10 import 'package:compiler/src/diagnostics/messages.dart'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 NativeThrowBehavior actualThrows; | 50 NativeThrowBehavior actualThrows; |
| 51 bool actualNew; | 51 bool actualNew; |
| 52 bool actualGvn; | 52 bool actualGvn; |
| 53 Listener listener = new Listener(); | 53 Listener listener = new Listener(); |
| 54 try { | 54 try { |
| 55 NativeBehavior.processSpecString(listener, null, specString, | 55 NativeBehavior.processSpecString(listener, null, specString, |
| 56 setSideEffects: (effects) => actualSideEffects = effects, | 56 setSideEffects: (effects) => actualSideEffects = effects, |
| 57 setThrows: (b) => actualThrows = b, | 57 setThrows: (b) => actualThrows = b, |
| 58 setIsAllocation: (b) => actualNew = b, | 58 setIsAllocation: (b) => actualNew = b, |
| 59 setUseGvn: (b) => actualGvn = b, | 59 setUseGvn: (b) => actualGvn = b, |
| 60 lookupType: (t) => t, | 60 lookupType: (t, {required}) => t, |
| 61 typesReturned: actualReturns, | 61 typesReturned: actualReturns, |
| 62 typesInstantiated: actualCreates, | 62 typesInstantiated: actualCreates, |
| 63 objectType: OBJECT, | 63 objectType: OBJECT, |
| 64 nullType: NULL); | 64 nullType: NULL); |
| 65 } catch (e) { | 65 } catch (e) { |
| 66 Expect.isTrue(expectError, 'Unexpected error "$specString"'); | 66 Expect.isTrue(expectError, 'Unexpected error "$specString"'); |
| 67 Expect.isNotNull(listener.errorMessage, 'Error message expected.'); | 67 Expect.isNotNull(listener.errorMessage, 'Error message expected.'); |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 Expect.isFalse(expectError, 'Missing error for "$specString".'); | 70 Expect.isFalse(expectError, 'Missing error for "$specString".'); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 test('gvn:false', expectedGvn: false); | 287 test('gvn:false', expectedGvn: false); |
| 288 test('returns:A;gvn:true', returns: ['A'], expectedGvn: true); | 288 test('returns:A;gvn:true', returns: ['A'], expectedGvn: true); |
| 289 test(' gvn : true ; returns:A;', returns: ['A'], expectedGvn: true); | 289 test(' gvn : true ; returns:A;', returns: ['A'], expectedGvn: true); |
| 290 test('gvn:true;returns:A;gvn:true', expectError: true); | 290 test('gvn:true;returns:A;gvn:true', expectError: true); |
| 291 | 291 |
| 292 test('gvn: true; new: true', expectError: true); | 292 test('gvn: true; new: true', expectError: true); |
| 293 test('gvn: true; new: false', expectedGvn: true, expectedNew: false); | 293 test('gvn: true; new: false', expectedGvn: true, expectedNew: false); |
| 294 test('gvn: false; new: true', expectedGvn: false, expectedNew: true); | 294 test('gvn: false; new: true', expectedGvn: false, expectedNew: true); |
| 295 test('gvn: false; new: false', expectedGvn: false, expectedNew: false); | 295 test('gvn: false; new: false', expectedGvn: false, expectedNew: false); |
| 296 } | 296 } |
| OLD | NEW |