hadley/testthat — pull request #195 by jackwasey (2014-11-07 11:20:10+00:00)
Title: function-level test coverage

Hadley, this represents a light-weight test coverage addition to testthat based on our email exchange.

It tests coverage at function level, which is easy, and not too slow to 'trace.'

There are coverage functions test_check_coverage() and test_package_coverage() which are analgous to test_check() and test_package(). I would suggest a coverage() function in devtools, analagous to devtools::test(), but working with the namespace magic in devtools to list functions in a package is beyond me.

```
> test_package_coverage("testthat")
$tested
[1] "context" "describe" "equals" "equals_reference"
[5] "evaluate_promise" "expectation" "expect_equal" "expect_equal_to_reference"
[9] "expect_equivalent" "expect_error" "expect_false" "expect_identical"
[13] "expect_is" "expect_less_than" "expect_match" "expect_message"
[17] "expect_more_than" "expect_output" "expect_that" "expect_true"
[21] "expect_warning" "fail" "get_reporter" "gives_warning"
[25] "is_a" "is_equivalent_to" "is.expectation" "is_false"
[29] "is_identical_to" "is_less_than" "is_more_than" "is_true"
[33] "matches" "not" "prints_text" "set_reporter"
[37] "shows_message" "skip" "skip_on_cran" "source_dir"
[41] "test_dir" "test_env" "test_file" "test_that"
[45] "throws_error" "with_mock" "with_reporter"

$untested
[1] "auto_test" "auto_test_package" "expect_named" "expect_null" "has_names"
[6] "is_null" "library_if_available" "ListReporter" "make_expectation" "MinimalReporter"
[11] "MultiReporter" "Reporter" "SilentReporter" "skip_on_travis" "StopReporter"
[16] "SummaryReporter" "takes_less_than" "TapReporter" "TeamcityReporter" "test_check"
[21] "test_check_coverage" "test_package" "test_package_coverage" "watch"

$coverage
[1] 0.6619718
```

Jack