| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:scheduled_test/descriptor.dart' as d; | 10 import 'package:scheduled_test/descriptor.dart' as d; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 // Wait a little bit to be sure that the tests don't start running without | 80 // Wait a little bit to be sure that the tests don't start running without |
| 81 // our input. | 81 // our input. |
| 82 await new Future.delayed(new Duration(seconds: 2)); | 82 await new Future.delayed(new Duration(seconds: 2)); |
| 83 expect(nextLineFired, isFalse); | 83 expect(nextLineFired, isFalse); |
| 84 }); | 84 }); |
| 85 | 85 |
| 86 test.writeLine(''); | 86 test.writeLine(''); |
| 87 test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); | 87 test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); |
| 88 test.shouldExit(0); | 88 test.shouldExit(0); |
| 89 }); | 89 }, tags: 'dartium'); |
| 90 | 90 |
| 91 test("pauses the test runner for each platform until the user presses enter", | 91 test("pauses the test runner for each platform until the user presses enter", |
| 92 () { | 92 () { |
| 93 d.file("test.dart", """ | 93 d.file("test.dart", """ |
| 94 import 'package:test/test.dart'; | 94 import 'package:test/test.dart'; |
| 95 | 95 |
| 96 void main() { | 96 void main() { |
| 97 print('loaded test!'); | 97 print('loaded test!'); |
| 98 | 98 |
| 99 test("success", () {}); | 99 test("success", () {}); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 // Wait a little bit to be sure that the tests don't start running without | 142 // Wait a little bit to be sure that the tests don't start running without |
| 143 // our input. | 143 // our input. |
| 144 await new Future.delayed(new Duration(seconds: 2)); | 144 await new Future.delayed(new Duration(seconds: 2)); |
| 145 expect(nextLineFired, isFalse); | 145 expect(nextLineFired, isFalse); |
| 146 }); | 146 }); |
| 147 | 147 |
| 148 test.writeLine(''); | 148 test.writeLine(''); |
| 149 test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); | 149 test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); |
| 150 test.shouldExit(0); | 150 test.shouldExit(0); |
| 151 }); | 151 }, tags: ['dartium', 'chrome']); |
| 152 | 152 |
| 153 test("prints a warning and doesn't pause for unsupported platforms", () { | 153 test("prints a warning and doesn't pause for unsupported platforms", () { |
| 154 d.file("test.dart", """ | 154 d.file("test.dart", """ |
| 155 import 'package:test/test.dart'; | 155 import 'package:test/test.dart'; |
| 156 | 156 |
| 157 void main() { | 157 void main() { |
| 158 test("success", () {}); | 158 test("success", () {}); |
| 159 } | 159 } |
| 160 """).create(); | 160 """).create(); |
| 161 | 161 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 }); | 205 }); |
| 206 | 206 |
| 207 test.writeLine(''); | 207 test.writeLine(''); |
| 208 | 208 |
| 209 test.stdout.expect(containsInOrder([ | 209 test.stdout.expect(containsInOrder([ |
| 210 "loaded test!", | 210 "loaded test!", |
| 211 "+1: [VM] success", | 211 "+1: [VM] success", |
| 212 "+2: All tests passed!" | 212 "+2: All tests passed!" |
| 213 ])); | 213 ])); |
| 214 test.shouldExit(0); | 214 test.shouldExit(0); |
| 215 }); | 215 }, tags: 'dartium'); |
| 216 | 216 |
| 217 test("stops immediately if killed while paused", () { | 217 test("stops immediately if killed while paused", () { |
| 218 d.file("test.dart", """ | 218 d.file("test.dart", """ |
| 219 import 'package:test/test.dart'; | 219 import 'package:test/test.dart'; |
| 220 | 220 |
| 221 void main() { | 221 void main() { |
| 222 print('loaded test!'); | 222 print('loaded test!'); |
| 223 | 223 |
| 224 test("success", () {}); | 224 test("success", () {}); |
| 225 } | 225 } |
| 226 """).create(); | 226 """).create(); |
| 227 | 227 |
| 228 var test = runTest(["--pause-after-load", "-p", "dartium", "test.dart"]); | 228 var test = runTest(["--pause-after-load", "-p", "dartium", "test.dart"]); |
| 229 test.stdout.expect(consumeThrough("loaded test!")); | 229 test.stdout.expect(consumeThrough("loaded test!")); |
| 230 test.stdout.expect(consumeThrough(inOrder([ | 230 test.stdout.expect(consumeThrough(inOrder([ |
| 231 startsWith("Observatory URL: "), | 231 startsWith("Observatory URL: "), |
| 232 "The test runner is paused. Open the dev console in Dartium or the " | 232 "The test runner is paused. Open the dev console in Dartium or the " |
| 233 "Observatory and set breakpoints.", | 233 "Observatory and set breakpoints.", |
| 234 "Once you're finished, return to this terminal and press Enter." | 234 "Once you're finished, return to this terminal and press Enter." |
| 235 ]))); | 235 ]))); |
| 236 | 236 |
| 237 test.signal(ProcessSignal.SIGTERM); | 237 test.signal(ProcessSignal.SIGTERM); |
| 238 test.shouldExit(); | 238 test.shouldExit(); |
| 239 test.stderr.expect(isDone); | 239 test.stderr.expect(isDone); |
| 240 }, testOn: "!windows"); | 240 }, tags: 'dartium', testOn: "!windows"); |
| 241 | 241 |
| 242 test("disables timeouts", () { | 242 test("disables timeouts", () { |
| 243 d.file("test.dart", """ | 243 d.file("test.dart", """ |
| 244 import 'dart:async'; | 244 import 'dart:async'; |
| 245 | 245 |
| 246 import 'package:test/test.dart'; | 246 import 'package:test/test.dart'; |
| 247 | 247 |
| 248 void main() { | 248 void main() { |
| 249 print('loaded test 1!'); | 249 print('loaded test 1!'); |
| 250 | 250 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 273 | 273 |
| 274 // Wait a little bit to be sure that the tests don't start running without | 274 // Wait a little bit to be sure that the tests don't start running without |
| 275 // our input. | 275 // our input. |
| 276 await new Future.delayed(new Duration(seconds: 2)); | 276 await new Future.delayed(new Duration(seconds: 2)); |
| 277 expect(nextLineFired, isFalse); | 277 expect(nextLineFired, isFalse); |
| 278 }); | 278 }); |
| 279 | 279 |
| 280 test.writeLine(''); | 280 test.writeLine(''); |
| 281 test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); | 281 test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); |
| 282 test.shouldExit(0); | 282 test.shouldExit(0); |
| 283 }); | 283 }, tags: 'dartium'); |
| 284 | 284 |
| 285 // Regression test for #304. | 285 // Regression test for #304. |
| 286 test("supports test name patterns", () { | 286 test("supports test name patterns", () { |
| 287 d.file("test.dart", """ | 287 d.file("test.dart", """ |
| 288 import 'package:test/test.dart'; | 288 import 'package:test/test.dart'; |
| 289 | 289 |
| 290 void main() { | 290 void main() { |
| 291 print('loaded test 1!'); | 291 print('loaded test 1!'); |
| 292 | 292 |
| 293 test("failure 1", () {}); | 293 test("failure 1", () {}); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 315 | 315 |
| 316 // Wait a little bit to be sure that the tests don't start running without | 316 // Wait a little bit to be sure that the tests don't start running without |
| 317 // our input. | 317 // our input. |
| 318 await new Future.delayed(new Duration(seconds: 2)); | 318 await new Future.delayed(new Duration(seconds: 2)); |
| 319 expect(nextLineFired, isFalse); | 319 expect(nextLineFired, isFalse); |
| 320 }); | 320 }); |
| 321 | 321 |
| 322 test.writeLine(''); | 322 test.writeLine(''); |
| 323 test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); | 323 test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); |
| 324 test.shouldExit(0); | 324 test.shouldExit(0); |
| 325 }); | 325 }, tags: 'dartium'); |
| 326 } | 326 } |
| OLD | NEW |