| OLD | NEW |
| 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 // Test that dart2js produces the expected static type warnings for type | 5 // Test that dart2js produces the expected static type warnings for type |
| 6 // promotion langauge tests. This ensures that the analyzer and dart2js agrees | 6 // promotion langauge tests. This ensures that the analyzer and dart2js agrees |
| 7 // on these tests. | 7 // on these tests. |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 'language/type_promotion_closure_test.dart', | 21 'language/type_promotion_closure_test.dart', |
| 22 'language/type_promotion_functions_test.dart', | 22 'language/type_promotion_functions_test.dart', |
| 23 'language/type_promotion_local_test.dart', | 23 'language/type_promotion_local_test.dart', |
| 24 'language/type_promotion_logical_and_test.dart', | 24 'language/type_promotion_logical_and_test.dart', |
| 25 'language/type_promotion_more_specific_test.dart', | 25 'language/type_promotion_more_specific_test.dart', |
| 26 'language/type_promotion_multiple_test.dart', | 26 'language/type_promotion_multiple_test.dart', |
| 27 'language/type_promotion_parameter_test.dart', | 27 'language/type_promotion_parameter_test.dart', |
| 28 ]; | 28 ]; |
| 29 | 29 |
| 30 void main() { | 30 void main() { |
| 31 bool isWindows = Platform.isWindows; | 31 bool isWindows = (Platform.operatingSystem == 'windows'); |
| 32 Uri script = currentDirectory.resolveUri(Platform.script); | 32 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script)); |
| 33 bool warningsMismatch = false; | 33 bool warningsMismatch = false; |
| 34 Future.forEach(TESTS, (String test) { | 34 Future.forEach(TESTS, (String test) { |
| 35 Uri uri = script.resolve('../../$test'); | 35 Uri uri = script.resolve('../../$test'); |
| 36 String source = UTF8.decode(readAll(uriPathToNative(uri.path))); | 36 String source = UTF8.decode(readAll(uriPathToNative(uri.path))); |
| 37 SourceFile file = new StringSourceFile( | 37 SourceFile file = new StringSourceFile( |
| 38 relativize(currentDirectory, uri, isWindows), source); | 38 relativize(currentDirectory, uri, isWindows), source); |
| 39 Map<int,String> expectedWarnings = {}; | 39 Map<int,String> expectedWarnings = {}; |
| 40 int lineNo = 0; | 40 int lineNo = 0; |
| 41 for (String line in source.split('\n')) { | 41 for (String line in source.split('\n')) { |
| 42 if (line.contains('///') && line.contains('static type warning')) { | 42 if (line.contains('///') && line.contains('static type warning')) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 69 String line = expectedWarnings[lineNo]; | 69 String line = expectedWarnings[lineNo]; |
| 70 print('$uri [${lineNo+1}]: Missing static type warning.'); | 70 print('$uri [${lineNo+1}]: Missing static type warning.'); |
| 71 print(line); | 71 print(line); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 }); | 74 }); |
| 75 }).then((_) { | 75 }).then((_) { |
| 76 Expect.isFalse(warningsMismatch); | 76 Expect.isFalse(warningsMismatch); |
| 77 }); | 77 }); |
| 78 } | 78 } |
| OLD | NEW |