| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library testing.chain; | 5 library testing.chain; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 Future, | 8 Future, |
| 9 Stream; | 9 Stream; |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 final List<RegExp> pattern; | 63 final List<RegExp> pattern; |
| 64 | 64 |
| 65 final List<RegExp> exclude; | 65 final List<RegExp> exclude; |
| 66 | 66 |
| 67 final bool processMultitests; | 67 final bool processMultitests; |
| 68 | 68 |
| 69 Chain(String name, String kind, this.source, this.uri, Uri statusFile, | 69 Chain(String name, String kind, this.source, this.uri, Uri statusFile, |
| 70 this.pattern, this.exclude, this.processMultitests) | 70 this.pattern, this.exclude, this.processMultitests) |
| 71 : super(name, kind, statusFile); | 71 : super(name, kind, statusFile); |
| 72 | 72 |
| 73 factory Chain.fromJsonMap( | 73 factory Chain.fromJsonMap(Uri base, Map json, String name, String kind) { |
| 74 Uri base, Map json, String name, String kind) { | |
| 75 Uri source = base.resolve(json["source"]); | 74 Uri source = base.resolve(json["source"]); |
| 76 Uri uri = base.resolve(json["path"]); | 75 Uri uri = base.resolve(json["path"]); |
| 77 Uri statusFile = base.resolve(json["status"]); | 76 Uri statusFile = base.resolve(json["status"]); |
| 78 List<RegExp> pattern = new List<RegExp>.from( | 77 List<RegExp> pattern = new List<RegExp>.from( |
| 79 json["pattern"].map((String p) => new RegExp(p))); | 78 json["pattern"].map((String p) => new RegExp(p))); |
| 80 List<RegExp> exclude = new List<RegExp>.from( | 79 List<RegExp> exclude = new List<RegExp>.from( |
| 81 json["exclude"].map((String p) => new RegExp(p))); | 80 json["exclude"].map((String p) => new RegExp(p))); |
| 82 bool processMultitests = json["process-multitests"] ?? false; | 81 bool processMultitests = json["process-multitests"] ?? false; |
| 83 return new Chain( | 82 return new Chain(name, kind, source, uri, statusFile, pattern, exclude, |
| 84 name, kind, source, uri, statusFile, pattern, exclude, processMultitests
); | 83 processMultitests); |
| 85 } | 84 } |
| 86 | 85 |
| 87 void writeImportOn(StringSink sink) { | 86 void writeImportOn(StringSink sink) { |
| 88 sink.write("import '"); | 87 sink.write("import '"); |
| 89 sink.write(source); | 88 sink.write(source); |
| 90 sink.write("' as "); | 89 sink.write("' as "); |
| 91 sink.write(name); | 90 sink.write(name); |
| 92 sink.writeln(";"); | 91 sink.writeln(";"); |
| 93 } | 92 } |
| 94 | 93 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 Future<Null> runChain( | 354 Future<Null> runChain( |
| 356 CreateContext f, Map<String, String> environment, Set<String> selectors, | 355 CreateContext f, Map<String, String> environment, Set<String> selectors, |
| 357 String json) { | 356 String json) { |
| 358 return withErrorHandling(() async { | 357 return withErrorHandling(() async { |
| 359 Chain suite = new Suite.fromJsonMap(Uri.base, JSON.decode(json)); | 358 Chain suite = new Suite.fromJsonMap(Uri.base, JSON.decode(json)); |
| 360 print("Running ${suite.name}"); | 359 print("Running ${suite.name}"); |
| 361 ChainContext context = await f(suite, environment); | 360 ChainContext context = await f(suite, environment); |
| 362 return context.run(suite, selectors); | 361 return context.run(suite, selectors); |
| 363 }); | 362 }); |
| 364 } | 363 } |
| OLD | NEW |