marijnh/CodeMirror — pull request #804 by bfrohs (2012-09-07 05:41:09+00:00)
Title: Fully integrate mode tests into main test harness, with extra features.

### Quick Look

- Integrated stex and Markdown mode tests into main test harness
- Added ability to restart tests partway through
- Added verbose option, to add message to output for *every* test
- Added ability to show verbose messages and run specific tests or all tests for 1+ mode(s) via location.hash
- Added support for custom messages (either return value [pass] or throw value [fail])
- Switched away from .innerHTML, .write(), etc in most places
- Make the progress bar actually 0px wide when 0% complete (and still keep padding)
- Added link to tests from each mode's demo page

Well, that was fun. You can choose which tests are actually done by adding the mode (or `core`) plus `_*` after the hash in the url. Some examples:

* `/test/index.html` - All tests
* `/test/index.html#core_*` - Only core tests (non-mode)
* `/test/index.html#markdown_*` - Only Markdown tests

To show the extra information for passed tests as well (e.g. expected output), simply add `verbose` immediately after the hash (modes can be included after, separated by `|`):

* `/test/index.html#verbose` - All tests, verbose output
* `/test/index.html#verbose|core_*` - Only core tests, verbose output

You can specify multiple modes as well. you just have to separate them with `|`:

* `/test/index.html#core_*|markdown_*` - Both core and Markdown tests, normal output
* `/test/index.html#verbose|core_*|markdown_*` - Both core and Markdown tests, verbose output

Additionally, you can choose specific tests. This can be combined with `verbose` and mode grouping. Just keep `verbose` first, and separate each test/mode with a `|`:

* `/test/index.html#core_coords` - Only the core_coords test
* `/test/index.html#core_coords|markdown` - Both the core_coords test and all Markdown tests

When possible, the progress bar will reflect the total number of tests. When an exact number is not possible, a `+` will appear after the number to alert the user.

I think this meets all of your requirements, but if you need another feature, or something tweaked, just let me know. There is still a bit of cleanup to do (moving functions around to make more sense, getting rid of some older ones, etc), but all of this can be done later on as it doesn't affect the performance or functionality.

**Note:** I was going to keep the two mode test file renames separate from the changes, but there were so many changes to the tests (removing HTML, changing indentation, changing function calls, etc) that it didn't help the diff at all.