| Index: dart/tests/try/web/program_result.dart
|
| diff --git a/dart/tests/try/web/program_result.dart b/dart/tests/try/web/program_result.dart
|
| index faa56516cf353eb3433438c3be1321ba43fb085f..a085a7ffb6ee4f10b02caf2ded7439fd18ae6a9f 100644
|
| --- a/dart/tests/try/web/program_result.dart
|
| +++ b/dart/tests/try/web/program_result.dart
|
| @@ -4,6 +4,8 @@
|
|
|
| library trydart.test.program_result;
|
|
|
| +import '../poi/source_update.dart';
|
| +
|
| class ProgramResult {
|
| final String code;
|
|
|
| @@ -17,4 +19,39 @@ class ProgramResult {
|
| List<String> messagesWith(String extra) {
|
| return new List<String>.from(messages)..add(extra);
|
| }
|
| +
|
| + static List<ProgramResult> decode(List encodedResults) {
|
| + if (encodedResults.length != 2) {
|
| + throw new ArgumentError(
|
| + "Unexpected encoding of program results: $encodedResults");
|
| + }
|
| + if (encodedResults[0].length == 1) {
|
| + throw new ArgumentError("Trivial diff, no reason to use decode.");
|
| + }
|
| + List<String> sources = expandUpdates(encodedResults[0]);
|
| + List<ProgramExpectation> expectations = encodedResults[1];
|
| + if (sources.length != expectations.length) {
|
| + throw new ArgumentError(
|
| + "Length mismatch: ${sources.length} != ${expectations.length}");
|
| + }
|
| + List<ProgramResult> result = new List<ProgramResult>(sources.length);
|
| + for (int i = 0; i < sources.length; i++) {
|
| + result[i] = expectations[i].toResult(sources[i]);
|
| + }
|
| + return result;
|
| + }
|
| +}
|
| +
|
| +class ProgramExpectation {
|
| + final List<String> messages;
|
| +
|
| + final bool compileUpdatesShouldThrow;
|
| +
|
| + const ProgramExpectation(
|
| + this.messages, {this.compileUpdatesShouldThrow: false});
|
| +
|
| + ProgramResult toResult(String code) {
|
| + return new ProgramResult(
|
| + code, messages, compileUpdatesShouldThrow: compileUpdatesShouldThrow);
|
| + }
|
| }
|
|
|