Chromium Code Reviews| Index: lib/unittest/config.dart |
| diff --git a/lib/unittest/config.dart b/lib/unittest/config.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..653eaaf3416d4d7248611963527495b705fac808 |
| --- /dev/null |
| +++ b/lib/unittest/config.dart |
| @@ -0,0 +1,47 @@ |
| +// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +/** |
|
Emily Fortuna
2012/04/10 18:14:12
should we be switching to the /// style comments?
Siggi Cherem (dart-lang)
2012/04/10 21:40:18
we should talk more about this. For now I want to
|
| + * Hooks to configure the unittest library for different platforms. This class |
| + * implements the API in a platform-independent way. Tests that want to take |
| + * advantage of the platform can create a subclass and override methods from |
| + * this class. |
| + */ |
| +class Configuration { |
| + /** |
| + * Called as soon as the unittest framework becomes initialized. This is done |
| + * even before tests are added to the test framework. It might be used to |
| + * determine/debug errors that occur before the test harness starts executing. |
| + */ |
| + void onInit() {} |
| + |
| + /** |
| + * Called as soon as the unittest framework starts running. Used commonly to |
| + * tell the vm or browser that tests are still running and the process should |
| + * wait until they are done. |
| + */ |
| + void onStart() {} |
| + |
| + /** |
| + * Called when each test is completed. The default implementation throws an |
| + * exception if the test failed. Other implementations might choose to ignore |
| + * this callback and present a summary result in [onDone]. |
| + */ |
| + void onTestResult(TestCase testCase) { |
| + if (testCase.result != _PASS) { |
| + Expect.fail("FAIL: ${testCase.description}"); |
|
Bob Nystrom
2012/04/10 20:04:25
Will this prevent subsequent tests in the suite fr
Siggi Cherem (dart-lang)
2012/04/10 21:40:18
I changed this just to print the result. It was on
|
| + } |
| + } |
| + |
| + /** |
| + * Called with the result of all test cases. The default implementation prints |
| + * the result summary using the built-in [print] command. Browser tests |
| + * commonly override this to reformat the output. |
| + */ |
| + void onDone(int passed, int failed, int errors, List<TestCase> results) { |
| + if (failed == 0 && errors == 0) { |
|
Bob Nystrom
2012/04/10 20:04:25
I think we should also report an error if there we
Siggi Cherem (dart-lang)
2012/04/10 21:40:18
Done. Basically I moved the VM logic here and chan
|
| + print("PASS"); |
| + } |
|
eub
2012/04/10 18:06:02
This implementation makes me scratch my head -- it
Siggi Cherem (dart-lang)
2012/04/10 21:40:18
This was related to the way I was failing on onTes
|
| + } |
| +} |