{"action":"created","issue":{"url":"https://api.github.com/repos/jimhester/covr/issues/50","labels_url":"https://api.github.com/repos/jimhester/covr/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/jimhester/covr/issues/50/comments","events_url":"https://api.github.com/repos/jimhester/covr/issues/50/events","html_url":"https://github.com/jimhester/covr/issues/50","id":56120229,"number":50,"title":"Functions calculated as closures are not covered","user":{"login":"renkun-ken","id":4662568,"avatar_url":"https://avatars.githubusercontent.com/u/4662568?v=3","gravatar_id":"","url":"https://api.github.com/users/renkun-ken","html_url":"https://github.com/renkun-ken","followers_url":"https://api.github.com/users/renkun-ken/followers","following_url":"https://api.github.com/users/renkun-ken/following{/other_user}","gists_url":"https://api.github.com/users/renkun-ken/gists{/gist_id}","starred_url":"https://api.github.com/users/renkun-ken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renkun-ken/subscriptions","organizations_url":"https://api.github.com/users/renkun-ken/orgs","repos_url":"https://api.github.com/users/renkun-ken/repos","events_url":"https://api.github.com/users/renkun-ken/events{/privacy}","received_events_url":"https://api.github.com/users/renkun-ken/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-31T10:10:45Z","updated_at":"2015-05-05T20:55:18Z","closed_at":null,"body":"From my package, it seems that package functions constructed by an internal meta-function is not traced. For example,\r\n\r\n```r\r\nfunction_builder <- function(x) {\r\n  function(a) {\r\n    x + a\r\n  }\r\n}}\r\n\r\n#' @export\r\nuseful_function1 <- function_builder(1)\r\n#' @export\r\nuseful_function2 <- function_builder(2)\r\n```\r\n\r\nEven if `useful_function1` and `useful_function2` are both called in tests, the closure `function(a) { x + a }` is always reported not covered.\r\n\r\nExample is here:\r\nThe code in red https://coveralls.io/builds/1833742/source?filename=.%2FR%2Fpipe.R#L183 is actually called test https://github.com/renkun-ken/pipeR/blob/master/tests/testthat/test2-Pipe.R#L64\r\n"},"comment":{"url":"https://api.github.com/repos/jimhester/covr/issues/comments/99219176","html_url":"https://github.com/jimhester/covr/issues/50#issuecomment-99219176","issue_url":"https://api.github.com/repos/jimhester/covr/issues/50","id":99219176,"user":{"login":"jimhester","id":205275,"avatar_url":"https://avatars.githubusercontent.com/u/205275?v=3","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T20:55:18Z","updated_at":"2015-05-05T20:55:18Z","body":"I guess you have two options.\r\n\r\n1. Call `Pipe_set_function` in one of your tests and test that it properly sets a function.  In this case the function should work like any other function.\r\n2. Exclude `Pipe_set_function` from coverage by adding a `# nocov start`, `# nocov end` around the functions"}}