| 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:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 10 import 'package:test/src/backend/state.dart'; | 10 import 'package:test/src/backend/state.dart'; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync(_tests); | 52 new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync(_tests); |
| 53 var suites = await _loader.loadFile(p.join(_sandbox, 'a_test.dart')) | 53 var suites = await _loader.loadFile(p.join(_sandbox, 'a_test.dart')) |
| 54 .toList(); | 54 .toList(); |
| 55 expect(suites, hasLength(1)); | 55 expect(suites, hasLength(1)); |
| 56 var loadSuite = suites.first; | 56 var loadSuite = suites.first; |
| 57 suite = await loadSuite.getSuite(); | 57 suite = await loadSuite.getSuite(); |
| 58 }); | 58 }); |
| 59 | 59 |
| 60 test("returns a suite with the file path and platform", () { | 60 test("returns a suite with the file path and platform", () { |
| 61 expect(suite.path, equals(p.join(_sandbox, 'a_test.dart'))); | 61 expect(suite.path, equals(p.join(_sandbox, 'a_test.dart'))); |
| 62 expect(suite.platform, equals('VM')); | 62 expect(suite.platform, equals(TestPlatform.vm)); |
| 63 }); | 63 }); |
| 64 | 64 |
| 65 test("returns tests with the correct names and platforms", () { | 65 test("returns tests with the correct names and platforms", () { |
| 66 expect(suite.tests, hasLength(3)); | 66 expect(suite.tests, hasLength(3)); |
| 67 expect(suite.tests[0].name, equals("success")); | 67 expect(suite.tests[0].name, equals("success")); |
| 68 expect(suite.tests[1].name, equals("failure")); | 68 expect(suite.tests[1].name, equals("failure")); |
| 69 expect(suite.tests[2].name, equals("error")); | 69 expect(suite.tests[2].name, equals("error")); |
| 70 }); | 70 }); |
| 71 | 71 |
| 72 test("can load and run a successful test", () { | 72 test("can load and run a successful test", () { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 var liveTest = await loadSuite.tests.single.load(loadSuite); | 161 var liveTest = await loadSuite.tests.single.load(loadSuite); |
| 162 expect(liveTest.onPrint.first, completion(equals("print within test"))); | 162 expect(liveTest.onPrint.first, completion(equals("print within test"))); |
| 163 await liveTest.run(); | 163 await liveTest.run(); |
| 164 expectTestPassed(liveTest); | 164 expectTestPassed(liveTest); |
| 165 }); | 165 }); |
| 166 | 166 |
| 167 // TODO: Test load suites. Don't forget to test that prints in loaded files | 167 // TODO: Test load suites. Don't forget to test that prints in loaded files |
| 168 // are piped through the suite. Also for browser tests! | 168 // are piped through the suite. Also for browser tests! |
| 169 } | 169 } |
| OLD | NEW |