magnars/buster.tmbundle — pull request #5 by ende76 (2012-03-27 10:11:38+00:00)
Title: Improved [cmd] + R to work on source files, too

Before, `[cmd] + R` would only work, if it was invoked on a file that contained test cases.

If it was invoked on a file that didn't contained any test cases, it would start the test runner anyway, and simply return with a message about 0 test cases.

With this improvement, the command checks first – by looking at the user's config file – if the current file is a test file. If yes, it runs it.

Otherwise, the command assumes that the current file is a source file, and tries to guess the location of the file that contains the relevant tests.

The main assumption is, that the folder structure of the source files is reflected in the folder structure of the test files, and maybe the test files have some kind of postfix to their name.

So, if a project looks like this:

`|+` lib
`||-` module1.js
`||-` module2.js
`||+` subpackage
`|||-`submodule1.js
`|+` spec
`||-` module1-test.js
`||-` module2-test.js
`||+` subpackage
`|||-`submodule1-test.js

the command now would be able to find the corresponding test files to module1.js, module2.js, submodule1.js respectively.

If no test file could be found even after guessing, then the test runner is not invoked, and instead a message about no tests being found is displayed.