{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/testthat/issues/320","labels_url":"https://api.github.com/repos/hadley/testthat/issues/320/labels{/name}","comments_url":"https://api.github.com/repos/hadley/testthat/issues/320/comments","events_url":"https://api.github.com/repos/hadley/testthat/issues/320/events","html_url":"https://github.com/hadley/testthat/pull/320","id":116766477,"number":320,"title":"new expectation: code runs without errors","user":{"login":"famuvie","id":5693966,"avatar_url":"https://avatars.githubusercontent.com/u/5693966?v=3","gravatar_id":"","url":"https://api.github.com/users/famuvie","html_url":"https://github.com/famuvie","followers_url":"https://api.github.com/users/famuvie/followers","following_url":"https://api.github.com/users/famuvie/following{/other_user}","gists_url":"https://api.github.com/users/famuvie/gists{/gist_id}","starred_url":"https://api.github.com/users/famuvie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/famuvie/subscriptions","organizations_url":"https://api.github.com/users/famuvie/orgs","repos_url":"https://api.github.com/users/famuvie/repos","events_url":"https://api.github.com/users/famuvie/events{/privacy}","received_events_url":"https://api.github.com/users/famuvie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-13T13:15:01Z","updated_at":"2015-11-13T13:15:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hadley/testthat/pulls/320","html_url":"https://github.com/hadley/testthat/pull/320","diff_url":"https://github.com/hadley/testthat/pull/320.diff","patch_url":"https://github.com/hadley/testthat/pull/320.patch"},"body":"I often use the following structure for testing that something **does not**\r\nthrow errors:\r\n\r\n```R\r\nres <- try(expr, silent = TRUE)\r\nexpect_false(inherits(res, 'try-error'))\r\n```\r\n\r\nwhich, in the case of failure, gives a message like:\r\n> Error: inherits(res, \"try-error\") isn't false\r\n\r\nI propose instead:\r\n```R\r\nexpect_try(expr)\r\n```\r\n\r\nwhich I find much cleaner.\r\nFurthermore, in the case of failure, the message is also cleaner:\r\n> Error: stop() threw an error\r\n"},"comment":{"url":"https://api.github.com/repos/hadley/testthat/issues/comments/156428841","html_url":"https://github.com/hadley/testthat/pull/320#issuecomment-156428841","issue_url":"https://api.github.com/repos/hadley/testthat/issues/320","id":156428841,"user":{"login":"famuvie","id":5693966,"avatar_url":"https://avatars.githubusercontent.com/u/5693966?v=3","gravatar_id":"","url":"https://api.github.com/users/famuvie","html_url":"https://github.com/famuvie","followers_url":"https://api.github.com/users/famuvie/followers","following_url":"https://api.github.com/users/famuvie/following{/other_user}","gists_url":"https://api.github.com/users/famuvie/gists{/gist_id}","starred_url":"https://api.github.com/users/famuvie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/famuvie/subscriptions","organizations_url":"https://api.github.com/users/famuvie/orgs","repos_url":"https://api.github.com/users/famuvie/repos","events_url":"https://api.github.com/users/famuvie/events{/privacy}","received_events_url":"https://api.github.com/users/famuvie/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T13:15:38Z","updated_at":"2015-11-13T13:15:38Z","body":"I admit the function names are not great.\r\nSuggestions welcome :)"}}