| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") | 5 @TestOn("vm") |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:scheduled_test/descriptor.dart' as d; | 9 import 'package:scheduled_test/descriptor.dart' as d; |
| 10 import 'package:scheduled_test/scheduled_stream.dart'; | 10 import 'package:scheduled_test/scheduled_stream.dart'; |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 406 |
| 407 d.file("test.dart", dart).create(); | 407 d.file("test.dart", dart).create(); |
| 408 | 408 |
| 409 var test = runTest(["test.dart"], reporter: "json"); | 409 var test = runTest(["test.dart"], reporter: "json"); |
| 410 test.shouldExit(); | 410 test.shouldExit(); |
| 411 | 411 |
| 412 schedule(() async { | 412 schedule(() async { |
| 413 var stdoutLines = await test.stdoutStream().toList(); | 413 var stdoutLines = await test.stdoutStream().toList(); |
| 414 | 414 |
| 415 expect(stdoutLines.length, equals(expected.length), | 415 expect(stdoutLines.length, equals(expected.length), |
| 416 reason: "Expected $stdoutLines to match $expected."); | 416 reason: "Expected $stdoutLines to match ${JSON.encode(expected)}."); |
| 417 | 417 |
| 418 // TODO(nweiz): validate each event against the JSON schema when | 418 // TODO(nweiz): validate each event against the JSON schema when |
| 419 // patefacio/json_schema#4 is merged. | 419 // patefacio/json_schema#4 is merged. |
| 420 | 420 |
| 421 // Remove excess trailing whitespace. | 421 // Remove excess trailing whitespace. |
| 422 for (var i = 0; i < stdoutLines.length; i++) { | 422 for (var i = 0; i < stdoutLines.length; i++) { |
| 423 var event = JSON.decode(stdoutLines[i]); | 423 var event = JSON.decode(stdoutLines[i]); |
| 424 expect(event.remove("time"), new isInstanceOf<int>()); | 424 expect(event.remove("time"), new isInstanceOf<int>()); |
| 425 event.remove("stackTrace"); | 425 event.remove("stackTrace"); |
| 426 expect(event, equals(expected[i])); | 426 expect(event, equals(expected[i])); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 /// Returns the serialized metadata corresponding to [skip]. | 543 /// Returns the serialized metadata corresponding to [skip]. |
| 544 Map _metadata({skip}) { | 544 Map _metadata({skip}) { |
| 545 if (skip == true) { | 545 if (skip == true) { |
| 546 return {"skip": true, "skipReason": null}; | 546 return {"skip": true, "skipReason": null}; |
| 547 } else if (skip is String) { | 547 } else if (skip is String) { |
| 548 return {"skip": true, "skipReason": skip}; | 548 return {"skip": true, "skipReason": skip}; |
| 549 } else { | 549 } else { |
| 550 return {"skip": false, "skipReason": null}; | 550 return {"skip": false, "skipReason": null}; |
| 551 } | 551 } |
| 552 } | 552 } |
| OLD | NEW |