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 library fletchc.test.feature_test; | 5 library fletchc.test.feature_test; |
6 | 6 |
7 import 'dart:io' hide | 7 import 'dart:io' hide |
8 exitCode, | 8 exitCode, |
9 stderr, | 9 stderr, |
10 stdin, | 10 stdin, |
(...skipping 22 matching lines...) Expand all Loading... |
33 import 'compiler_test_case.dart' show | 33 import 'compiler_test_case.dart' show |
34 CompilerTestCase; | 34 CompilerTestCase; |
35 | 35 |
36 import 'package:compiler/src/elements/elements.dart' show | 36 import 'package:compiler/src/elements/elements.dart' show |
37 AbstractFieldElement, | 37 AbstractFieldElement, |
38 Element, | 38 Element, |
39 FieldElement, | 39 FieldElement, |
40 FunctionElement, | 40 FunctionElement, |
41 LibraryElement; | 41 LibraryElement; |
42 | 42 |
43 import 'package:compiler/src/dart2jslib.dart' show | 43 import 'package:compiler/src/compiler.dart' show |
44 Compiler; | 44 Compiler; |
45 | 45 |
46 import 'package:compiler/src/source_file_provider.dart' show | 46 import 'package:compiler/src/source_file_provider.dart' show |
47 FormattingDiagnosticHandler, | 47 FormattingDiagnosticHandler, |
48 SourceFileProvider; | 48 SourceFileProvider; |
49 | 49 |
50 import 'package:compiler/src/io/source_file.dart' show | 50 import 'package:compiler/src/io/source_file.dart' show |
51 StringSourceFile; | 51 StringSourceFile; |
52 | 52 |
53 import 'package:fletchc/incremental/fletchc_incremental.dart' show | 53 import 'package:fletchc/incremental/fletchc_incremental.dart' show |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 await session.toggleInternal(); | 254 await session.toggleInternal(); |
255 } | 255 } |
256 | 256 |
257 if (result.successful) { | 257 if (result.successful) { |
258 // Set breakpoint in main in case main was replaced. | 258 // Set breakpoint in main in case main was replaced. |
259 var breakpoints = | 259 var breakpoints = |
260 await session.setBreakpoint(methodName: "main", bytecodeIndex: 0); | 260 await session.setBreakpoint(methodName: "main", bytecodeIndex: 0); |
261 for (var breakpoint in breakpoints) { | 261 for (var breakpoint in breakpoints) { |
262 print("Added breakpoint: $breakpoint"); | 262 print("Added breakpoint: $breakpoint"); |
263 } | 263 } |
264 if (!helper.compiler.compiler.mainFunction.isErroneous) { | 264 if (!helper.compiler.compiler.mainFunction.isMalformed) { |
265 // If there's a syntax error in main, we cannot find it to set a | 265 // If there's a syntax error in main, we cannot find it to set a |
266 // breakpoint. | 266 // breakpoint. |
267 // TODO(ahe): Consider if this is a problem? | 267 // TODO(ahe): Consider if this is a problem? |
268 Expect.equals(1, breakpoints.length); | 268 Expect.equals(1, breakpoints.length); |
269 } | 269 } |
270 if (isFirstProgram) { | 270 if (isFirstProgram) { |
271 // Run the program to hit the breakpoint in main. | 271 // Run the program to hit the breakpoint in main. |
272 await session.debugRun(); | 272 await session.debugRun(); |
273 } else { | 273 } else { |
274 // Restart the current frame to rerun main. | 274 // Restart the current frame to rerun main. |
(...skipping 17 matching lines...) Expand all Loading... |
292 print(trace.format()); | 292 print(trace.format()); |
293 | 293 |
294 List<String> messages = new List<String>.from(program.messages); | 294 List<String> messages = new List<String>.from(program.messages); |
295 if (program.hasCompileTimeError) { | 295 if (program.hasCompileTimeError) { |
296 print("Compile-time error expected"); | 296 print("Compile-time error expected"); |
297 // TODO(ahe): This message shouldn't be printed by the Fletch VM. | 297 // TODO(ahe): This message shouldn't be printed by the Fletch VM. |
298 messages.add("Compile error"); | 298 messages.add("Compile error"); |
299 } | 299 } |
300 | 300 |
301 List<String> actualMessages = session.stdoutSink.takeLines(); | 301 List<String> actualMessages = session.stdoutSink.takeLines(); |
302 Expect.listEquals(messages, actualMessages); | 302 Expect.listEquals(messages, actualMessages, |
| 303 "Expected $messages, got $actualMessages"); |
303 | 304 |
304 // TODO(ahe): Enable SerializeScopeTestCase for multiple parts. | 305 // TODO(ahe): Enable SerializeScopeTestCase for multiple parts. |
305 if (!isFirstProgram && program.code is String) { | 306 if (!isFirstProgram && program.code is String) { |
306 await new SerializeScopeTestCase( | 307 await new SerializeScopeTestCase( |
307 program.code, helper.compiler.mainApp, | 308 program.code, helper.compiler.mainApp, |
308 helper.compiler.compiler).run(); | 309 helper.compiler.compiler).run(); |
309 } | 310 } |
310 } | 311 } |
311 } | 312 } |
312 | 313 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 756 |
756 Future<List<int>> readUtf8BytesFromUri(Uri uri) { | 757 Future<List<int>> readUtf8BytesFromUri(Uri uri) { |
757 throw "not supported"; | 758 throw "not supported"; |
758 } | 759 } |
759 | 760 |
760 static String readCachedFile(Uri uri) { | 761 static String readCachedFile(Uri uri) { |
761 return cachedFiles.putIfAbsent( | 762 return cachedFiles.putIfAbsent( |
762 uri, () => new File.fromUri(uri).readAsStringSync()); | 763 uri, () => new File.fromUri(uri).readAsStringSync()); |
763 } | 764 } |
764 } | 765 } |
OLD | NEW |