{"action":"created","comment":{"url":"https://api.github.com/repos/dlang/druntime/pulls/comments/93831267","pull_request_review_id":14365996,"id":93831267,"diff_hunk":"@@ -328,46 +354,58 @@ struct Runtime\n      *\n      *             if (fp)\n      *             {\n+     *                 ++nRun;\n      *                 try\n      *                 {\n      *                     fp();\n      *                 }\n      *                 catch (Throwable e)\n      *                 {\n      *                     writeln(e);\n-     *                     failed++;\n+     *                     --failed;\n      *                 }\n      *             }\n      *         }\n      *     }\n-     *     return failed == 0;\n+     *     return failed == 0 ? nRun : failed;\n      * }\n      * ---------\n      */\n     static @property void moduleUnitTester( ModuleUnitTester h )\n     {\n         sm_moduleUnitTester = h;\n+        sm_boolModuleUnitTester = null;\n     }\n \n+    /// Ditto\n+    static @property void moduleUnitTester( BoolModuleUnitTester h )\n+    {\n+        sm_moduleUnitTester = null;\n+        sm_boolModuleUnitTester = h;\n+    }\n \n     /**\n-     * Gets the current module unit tester.\n+     * Gets the current module unit tester. Note that if a boolean returning\n+     * module unit tester is set, it will be returned, even though the type is\n+     * not exactly the same.\n      *\n      * Returns:\n      *  The current module unit tester handler or null if none has been set.\n      */\n     static @property ModuleUnitTester moduleUnitTester()\n     {\n+        if(sm_moduleUnitTester == null)\n+            return cast(ModuleUnitTester)sm_boolModuleUnitTester;","path":"src/core/runtime.d","position":107,"original_position":107,"commit_id":"0773c78f26616c8f958caa6be49b59d44c631873","original_commit_id":"0773c78f26616c8f958caa6be49b59d44c631873","user":{"login":"andralex","id":566679,"avatar_url":"https://avatars.githubusercontent.com/u/566679?v=3","gravatar_id":"","url":"https://api.github.com/users/andralex","html_url":"https://github.com/andralex","followers_url":"https://api.github.com/users/andralex/followers","following_url":"https://api.github.com/users/andralex/following{/other_user}","gists_url":"https://api.github.com/users/andralex/gists{/gist_id}","starred_url":"https://api.github.com/users/andralex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andralex/subscriptions","organizations_url":"https://api.github.com/users/andralex/orgs","repos_url":"https://api.github.com/users/andralex/repos","events_url":"https://api.github.com/users/andralex/events{/privacy}","received_events_url":"https://api.github.com/users/andralex/received_events","type":"User","site_admin":false},"body":"Instead of the cast use a small lambda?","created_at":"2016-12-25T16:12:29Z","updated_at":"2016-12-25T16:15:00Z","html_url":"https://github.com/dlang/druntime/pull/1685#discussion_r93831267","pull_request_url":"https://api.github.com/repos/dlang/druntime/pulls/1685","_links":{"self":{"href":"https://api.github.com/repos/dlang/druntime/pulls/comments/93831267"},"html":{"href":"https://github.com/dlang/druntime/pull/1685#discussion_r93831267"},"pull_request":{"href":"https://api.github.com/repos/dlang/druntime/pulls/1685"}}},"pull_request":{"url":"https://api.github.com/repos/dlang/druntime/pulls/1685","id":91254948,"html_url":"https://github.com/dlang/druntime/pull/1685","diff_url":"https://github.com/dlang/druntime/pull/1685.diff","patch_url":"https://github.com/dlang/druntime/pull/1685.patch","issue_url":"https://api.github.com/repos/dlang/druntime/issues/1685","number":1685,"state":"open","locked":false,"title":"[WIP] Modify unittest handling","user":{"login":"schveiguy","id":580778,"avatar_url":"https://avatars.githubusercontent.com/u/580778?v=3","gravatar_id":"","url":"https://api.github.com/users/schveiguy","html_url":"https://github.com/schveiguy","followers_url":"https://api.github.com/users/schveiguy/followers","following_url":"https://api.github.com/users/schveiguy/following{/other_user}","gists_url":"https://api.github.com/users/schveiguy/gists{/gist_id}","starred_url":"https://api.github.com/users/schveiguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schveiguy/subscriptions","organizations_url":"https://api.github.com/users/schveiguy/orgs","repos_url":"https://api.github.com/users/schveiguy/repos","events_url":"https://api.github.com/users/schveiguy/events{/privacy}","received_events_url":"https://api.github.com/users/schveiguy/received_events","type":"User","site_admin":false},"body":"Currently, if unit tests run and all pass, the program is started. Typically users expect the main function to exit immediately, so they instrument their main program with\n\n``` D\nversion(unittest) { void main() {} }\nelse int main(string[] args)\n{\n   ...\n}\n```\n\nBut this sucks. D shouldn't be running the main program after unit testing (by default). This can be an opt-in for the user, but should default to exiting.\n\nThis modification changes the unit test handler to return `int` instead of `bool` to signify different handling of the unit test result. If the handler function returns 0, then the main function is run. If the handler returns nonzero, the main function is not run. If the result is `int.min`, then the program exits with a failure exit code. If the result is negative, the program prints the negated value as the number of modules that failed, and exits with a failure exit code. If the result is positive, that number is printed as the number of modules that were tested, and exits with a success exit code.\n\nthe API for setting the handler routine should be backwards compatible, as I allow setting of the handler routine as a bool return or an int return. The one place where it may be incorrect is if you fetch the handler routine and you set a bool version. This code casts it to an int-returning routine. The effect may be very negligible, as I believe both would return using a register. I did the cast mainly to allow code that checks to see which exact routine is installed will work. I'm expecting there's almost no usage of the getter property there anyway.\n\nPossible improvements -- we may want to only enable this behavior with a `-DRT` switch. Or we may want to allow the previous behavior with such a switch. We may want to separate the bool/int handlers into a different API so the getter makes more sense if complaints arise.\n\nI'm adding this for testing and also to allow for discussion.\n","created_at":"2016-10-27T18:26:41Z","updated_at":"2016-12-25T16:15:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"311897cc8bc12afe914b25d718c81a1f8363dfdb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dlang/druntime/pulls/1685/commits","review_comments_url":"https://api.github.com/repos/dlang/druntime/pulls/1685/comments","review_comment_url":"https://api.github.com/repos/dlang/druntime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dlang/druntime/issues/1685/comments","statuses_url":"https://api.github.com/repos/dlang/druntime/statuses/0773c78f26616c8f958caa6be49b59d44c631873","head":{"label":"schveiguy:exitafterunittest","ref":"exitafterunittest","sha":"0773c78f26616c8f958caa6be49b59d44c631873","user":{"login":"schveiguy","id":580778,"avatar_url":"https://avatars.githubusercontent.com/u/580778?v=3","gravatar_id":"","url":"https://api.github.com/users/schveiguy","html_url":"https://github.com/schveiguy","followers_url":"https://api.github.com/users/schveiguy/followers","following_url":"https://api.github.com/users/schveiguy/following{/other_user}","gists_url":"https://api.github.com/users/schveiguy/gists{/gist_id}","starred_url":"https://api.github.com/users/schveiguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schveiguy/subscriptions","organizations_url":"https://api.github.com/users/schveiguy/orgs","repos_url":"https://api.github.com/users/schveiguy/repos","events_url":"https://api.github.com/users/schveiguy/events{/privacy}","received_events_url":"https://api.github.com/users/schveiguy/received_events","type":"User","site_admin":false},"repo":{"id":1356644,"name":"druntime","full_name":"schveiguy/druntime","owner":{"login":"schveiguy","id":580778,"avatar_url":"https://avatars.githubusercontent.com/u/580778?v=3","gravatar_id":"","url":"https://api.github.com/users/schveiguy","html_url":"https://github.com/schveiguy","followers_url":"https://api.github.com/users/schveiguy/followers","following_url":"https://api.github.com/users/schveiguy/following{/other_user}","gists_url":"https://api.github.com/users/schveiguy/gists{/gist_id}","starred_url":"https://api.github.com/users/schveiguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schveiguy/subscriptions","organizations_url":"https://api.github.com/users/schveiguy/orgs","repos_url":"https://api.github.com/users/schveiguy/repos","events_url":"https://api.github.com/users/schveiguy/events{/privacy}","received_events_url":"https://api.github.com/users/schveiguy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/schveiguy/druntime","description":"Low level runtime library for the D programming language","fork":true,"url":"https://api.github.com/repos/schveiguy/druntime","forks_url":"https://api.github.com/repos/schveiguy/druntime/forks","keys_url":"https://api.github.com/repos/schveiguy/druntime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/schveiguy/druntime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/schveiguy/druntime/teams","hooks_url":"https://api.github.com/repos/schveiguy/druntime/hooks","issue_events_url":"https://api.github.com/repos/schveiguy/druntime/issues/events{/number}","events_url":"https://api.github.com/repos/schveiguy/druntime/events","assignees_url":"https://api.github.com/repos/schveiguy/druntime/assignees{/user}","branches_url":"https://api.github.com/repos/schveiguy/druntime/branches{/branch}","tags_url":"https://api.github.com/repos/schveiguy/druntime/tags","blobs_url":"https://api.github.com/repos/schveiguy/druntime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/schveiguy/druntime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/schveiguy/druntime/git/refs{/sha}","trees_url":"https://api.github.com/repos/schveiguy/druntime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/schveiguy/druntime/statuses/{sha}","languages_url":"https://api.github.com/repos/schveiguy/druntime/languages","stargazers_url":"https://api.github.com/repos/schveiguy/druntime/stargazers","contributors_url":"https://api.github.com/repos/schveiguy/druntime/contributors","subscribers_url":"https://api.github.com/repos/schveiguy/druntime/subscribers","subscription_url":"https://api.github.com/repos/schveiguy/druntime/subscription","commits_url":"https://api.github.com/repos/schveiguy/druntime/commits{/sha}","git_commits_url":"https://api.github.com/repos/schveiguy/druntime/git/commits{/sha}","comments_url":"https://api.github.com/repos/schveiguy/druntime/comments{/number}","issue_comment_url":"https://api.github.com/repos/schveiguy/druntime/issues/comments{/number}","contents_url":"https://api.github.com/repos/schveiguy/druntime/contents/{+path}","compare_url":"https://api.github.com/repos/schveiguy/druntime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/schveiguy/druntime/merges","archive_url":"https://api.github.com/repos/schveiguy/druntime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/schveiguy/druntime/downloads","issues_url":"https://api.github.com/repos/schveiguy/druntime/issues{/number}","pulls_url":"https://api.github.com/repos/schveiguy/druntime/pulls{/number}","milestones_url":"https://api.github.com/repos/schveiguy/druntime/milestones{/number}","notifications_url":"https://api.github.com/repos/schveiguy/druntime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/schveiguy/druntime/labels{/name}","releases_url":"https://api.github.com/repos/schveiguy/druntime/releases{/id}","deployments_url":"https://api.github.com/repos/schveiguy/druntime/deployments","created_at":"2011-02-11T21:03:49Z","updated_at":"2015-02-10T17:20:37Z","pushed_at":"2016-12-23T14:17:33Z","git_url":"git://github.com/schveiguy/druntime.git","ssh_url":"git@github.com:schveiguy/druntime.git","clone_url":"https://github.com/schveiguy/druntime.git","svn_url":"https://github.com/schveiguy/druntime","homepage":"d-programming-language.org","size":12934,"stargazers_count":1,"watchers_count":1,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dlang:master","ref":"master","sha":"6923621a699b922641ca15f348f8db395387eb43","user":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"repo":{"id":1257087,"name":"druntime","full_name":"dlang/druntime","owner":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dlang/druntime","description":"Low level runtime library for the D programming language","fork":false,"url":"https://api.github.com/repos/dlang/druntime","forks_url":"https://api.github.com/repos/dlang/druntime/forks","keys_url":"https://api.github.com/repos/dlang/druntime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dlang/druntime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dlang/druntime/teams","hooks_url":"https://api.github.com/repos/dlang/druntime/hooks","issue_events_url":"https://api.github.com/repos/dlang/druntime/issues/events{/number}","events_url":"https://api.github.com/repos/dlang/druntime/events","assignees_url":"https://api.github.com/repos/dlang/druntime/assignees{/user}","branches_url":"https://api.github.com/repos/dlang/druntime/branches{/branch}","tags_url":"https://api.github.com/repos/dlang/druntime/tags","blobs_url":"https://api.github.com/repos/dlang/druntime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dlang/druntime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dlang/druntime/git/refs{/sha}","trees_url":"https://api.github.com/repos/dlang/druntime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dlang/druntime/statuses/{sha}","languages_url":"https://api.github.com/repos/dlang/druntime/languages","stargazers_url":"https://api.github.com/repos/dlang/druntime/stargazers","contributors_url":"https://api.github.com/repos/dlang/druntime/contributors","subscribers_url":"https://api.github.com/repos/dlang/druntime/subscribers","subscription_url":"https://api.github.com/repos/dlang/druntime/subscription","commits_url":"https://api.github.com/repos/dlang/druntime/commits{/sha}","git_commits_url":"https://api.github.com/repos/dlang/druntime/git/commits{/sha}","comments_url":"https://api.github.com/repos/dlang/druntime/comments{/number}","issue_comment_url":"https://api.github.com/repos/dlang/druntime/issues/comments{/number}","contents_url":"https://api.github.com/repos/dlang/druntime/contents/{+path}","compare_url":"https://api.github.com/repos/dlang/druntime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dlang/druntime/merges","archive_url":"https://api.github.com/repos/dlang/druntime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dlang/druntime/downloads","issues_url":"https://api.github.com/repos/dlang/druntime/issues{/number}","pulls_url":"https://api.github.com/repos/dlang/druntime/pulls{/number}","milestones_url":"https://api.github.com/repos/dlang/druntime/milestones{/number}","notifications_url":"https://api.github.com/repos/dlang/druntime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dlang/druntime/labels{/name}","releases_url":"https://api.github.com/repos/dlang/druntime/releases{/id}","deployments_url":"https://api.github.com/repos/dlang/druntime/deployments","created_at":"2011-01-15T07:01:38Z","updated_at":"2016-12-11T07:04:36Z","pushed_at":"2016-12-25T13:12:11Z","git_url":"git://github.com/dlang/druntime.git","ssh_url":"git@github.com:dlang/druntime.git","clone_url":"https://github.com/dlang/druntime.git","svn_url":"https://github.com/dlang/druntime","homepage":"dlang.org","size":13092,"stargazers_count":419,"watchers_count":419,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":296,"mirror_url":null,"open_issues_count":61,"forks":296,"open_issues":61,"watchers":419,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dlang/druntime/pulls/1685"},"html":{"href":"https://github.com/dlang/druntime/pull/1685"},"issue":{"href":"https://api.github.com/repos/dlang/druntime/issues/1685"},"comments":{"href":"https://api.github.com/repos/dlang/druntime/issues/1685/comments"},"review_comments":{"href":"https://api.github.com/repos/dlang/druntime/pulls/1685/comments"},"review_comment":{"href":"https://api.github.com/repos/dlang/druntime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dlang/druntime/pulls/1685/commits"},"statuses":{"href":"https://api.github.com/repos/dlang/druntime/statuses/0773c78f26616c8f958caa6be49b59d44c631873"}}}}
{"actor":{"display_login":"andralex"}}