| 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/dart2jslib.dart' | 9 import 'package:compiler/src/dart2jslib.dart' |
| 10 show DiagnosticListener; | 10 show DiagnosticListener; |
| 11 import 'package:compiler/src/universe/universe.dart' | 11 import 'package:compiler/src/universe/universe.dart' |
| 12 show SideEffects; | 12 show SideEffects; |
| 13 | 13 |
| 14 const OBJECT = 'Object'; | 14 const OBJECT = 'Object'; |
| 15 const NULL = 'Null'; | 15 const NULL = 'Null'; |
| 16 | 16 |
| 17 class Listener implements DiagnosticListener { | 17 class Listener implements DiagnosticListener { |
| 18 String errorMessage; | 18 String errorMessage; |
| 19 internalError(spannable, message) { | 19 internalError(spannable, message) { |
| 20 errorMessage = message; | 20 errorMessage = message; |
| 21 throw "error"; | 21 throw "error"; |
| 22 } | 22 } |
| 23 reportError(spannable, kind, arguments) { | 23 reportError(spannable, kind, [arguments]) { |
| 24 errorMessage = '$arguments'; // E.g. "{text: Duplicate tag 'new'.}" | 24 errorMessage = '$arguments'; // E.g. "{text: Duplicate tag 'new'.}" |
| 25 throw "error"; | 25 throw "error"; |
| 26 } | 26 } |
| 27 | 27 |
| 28 noSuchMethod(_) => null; | 28 noSuchMethod(_) => null; |
| 29 } | 29 } |
| 30 | 30 |
| 31 void test(String specString, | 31 void test(String specString, |
| 32 {List returns, | 32 {List returns, |
| 33 List creates, | 33 List creates, |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 test('gvn:false', expectedGvn: false); | 276 test('gvn:false', expectedGvn: false); |
| 277 test('returns:A;gvn:true', returns: ['A'], expectedGvn: true); | 277 test('returns:A;gvn:true', returns: ['A'], expectedGvn: true); |
| 278 test(' gvn : true ; returns:A;', returns: ['A'], expectedGvn: true); | 278 test(' gvn : true ; returns:A;', returns: ['A'], expectedGvn: true); |
| 279 test('gvn:true;returns:A;gvn:true', expectError: true); | 279 test('gvn:true;returns:A;gvn:true', expectError: true); |
| 280 | 280 |
| 281 test('gvn: true; new: true', expectError: true); | 281 test('gvn: true; new: true', expectError: true); |
| 282 test('gvn: true; new: false', expectedGvn: true, expectedNew: false); | 282 test('gvn: true; new: false', expectedGvn: true, expectedNew: false); |
| 283 test('gvn: false; new: true', expectedGvn: false, expectedNew: true); | 283 test('gvn: false; new: true', expectedGvn: false, expectedNew: true); |
| 284 test('gvn: false; new: false', expectedGvn: false, expectedNew: false); | 284 test('gvn: false; new: false', expectedGvn: false, expectedNew: false); |
| 285 } | 285 } |
| OLD | NEW |