0.1 Release 2012 WebVTT Test Suite
Introduction
Bug https://github.com/rillian/webvtt/issues/7
In order to write our parser, we'll need a way to prove it's correct as per the spec. Doing so involves the creation of a spec conformance test suite, consisting of good and bad WebVTT files. Each test file makes sure that a particular part of the spec is true, and forces the parser to do various things.
When writing test files, remember that each test should test only one thing. Make them simple, small, and discrete. All you're doing is writing a WebVTT file with enough data in it to trigger a rule in the parser.
Example
The spec says (http://dev.w3.org/html5/webvtt/#webvtt-file-body) that the file must begin with an optional BOM character, followed by the string WEBVTT. Assuming you're testing the optional BOM character not being present, you'd expect the following file to be valid:
WEBVTT
And the following file to be invalid:
NOT WEBVTT
The first file should go in the good/ directory, the second in bad/, indicating that we expect the first to validate, and the second to fail.