Add MD014 with tests.

This commit is contained in:
David Anson 2015-03-05 23:30:01 -08:00
parent 434c7f388c
commit 62314e61b1
4 changed files with 55 additions and 3 deletions

33
test/code_block_dollar.md Normal file
View file

@ -0,0 +1,33 @@
The following code block shouldn't have $ before the commands:
$ ls {MD014}
$ less foo
$ cat bar
However the following code block shows output, and $ can be used to
distinguish between command and output:
$ ls
foo bar
$ less foo
Hello world
$ cat bar
baz
The following code block uses variable names, and likewise shouldn't fire:
$foo = 'bar';
$baz = 'qux';
The following code block doesn't have any dollar signs, and shouldn't fire:
ls foo
cat bar
The following (fenced) code block doesn't have any content at all, and
shouldn't fire:
```
```

View file

@ -31,7 +31,7 @@ function createTestForFile(file) {
var expectedPromise = Q.nfcall(fs.readFile, file, { "encoding": "utf8" })
.then(
function fileContents(contents) {
var lines = contents.split(/\r\n|\r|\n/g);
var lines = contents.split(/\r\n|\r|\n/);
var results = {};
lines.forEach(function forLine(line, lineNum) {
var regex = /\{(MD\d+)(?::(\d+))?\}/g;