Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed Mar 23, 2015
1 parent 984a62b commit 6ab16c9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
24 changes: 24 additions & 0 deletions README.md
Expand Up @@ -183,6 +183,30 @@ You can easily combine both ways:
Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
```
Tests
=====
Done with [bats](https://github.com/sstephenson/bats).
Useful articles:
* https://blog.engineyard.com/2014/bats-test-command-line-tools
* http://blog.spike.cx/post/60548255435/testing-bash-scripts-with-bats
How to run tests:
```bash
➥ make test Пн. марта 23 13:59:27 MSK 2015
✓ TOC for local README.md
✓ TOC for remote README.md
✓ TOC for mixed README.md (remote/local)
✓ TOC for markdown from stdin
✓ --help
✓ --version

6 tests, 0 failures
```
Dependency
==========
Expand Down
21 changes: 12 additions & 9 deletions tests/tests.bats
Expand Up @@ -17,8 +17,9 @@ load test_helper
assert_equal "${lines[7]}" " * [Local files](#local-files)"
assert_equal "${lines[8]}" " * [Remote files](#remote-files)"
assert_equal "${lines[9]}" " * [Combo](#combo)"
assert_equal "${lines[10]}" " * [Dependency](#dependency)"
assert_equal "${lines[11]}" "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"
assert_equal "${lines[10]}" " * [Tests](#tests)"
assert_equal "${lines[11]}" " * [Dependency](#dependency)"
assert_equal "${lines[12]}" "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"

}

Expand Down Expand Up @@ -49,12 +50,13 @@ load test_helper
assert_equal "${lines[5]}" " * [Local files](README.md#local-files)"
assert_equal "${lines[6]}" " * [Remote files](README.md#remote-files)"
assert_equal "${lines[7]}" " * [Combo](README.md#combo)"
assert_equal "${lines[8]}" " * [Dependency](README.md#dependency)"
assert_equal "${lines[9]}" " * [sitemap.js](https://github.com/ekalinin/sitemap.js/blob/master/README.md#sitemapjs)"
assert_equal "${lines[10]}" " * [Installation](https://github.com/ekalinin/sitemap.js/blob/master/README.md#installation)"
assert_equal "${lines[11]}" " * [Usage](https://github.com/ekalinin/sitemap.js/blob/master/README.md#usage)"
assert_equal "${lines[12]}" " * [License](https://github.com/ekalinin/sitemap.js/blob/master/README.md#license)"
assert_equal "${lines[13]}" "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"
assert_equal "${lines[8]}" " * [Tests](README.md#tests)"
assert_equal "${lines[9]}" " * [Dependency](README.md#dependency)"
assert_equal "${lines[10]}" " * [sitemap.js](https://github.com/ekalinin/sitemap.js/blob/master/README.md#sitemapjs)"
assert_equal "${lines[11]}" " * [Installation](https://github.com/ekalinin/sitemap.js/blob/master/README.md#installation)"
assert_equal "${lines[12]}" " * [Usage](https://github.com/ekalinin/sitemap.js/blob/master/README.md#usage)"
assert_equal "${lines[13]}" " * [License](https://github.com/ekalinin/sitemap.js/blob/master/README.md#license)"
assert_equal "${lines[14]}" "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"
}

@test "TOC for markdown from stdin" {
Expand All @@ -69,7 +71,8 @@ load test_helper
assert_equal "${lines[5]}" " * [Local files](#local-files)"
assert_equal "${lines[6]}" " * [Remote files](#remote-files)"
assert_equal "${lines[7]}" " * [Combo](#combo)"
assert_equal "${lines[8]}" " * [Dependency](#dependency)"
assert_equal "${lines[8]}" " * [Tests](#tests)"
assert_equal "${lines[9]}" " * [Dependency](#dependency)"
}
}

Expand Down

0 comments on commit 6ab16c9

Please sign in to comment.