{"action":"created","comment":{"url":"https://api.github.com/repos/gfredericks/test.chuck/pulls/comments/39117291","id":39117291,"diff_hunk":"@@ -0,0 +1,63 @@\n+(ns com.gfredericks.test.chuck.exception-handling-test\n+  (:require #?(:clj  [clojure.test :refer :all]\n+               :cljs [cljs.test :as test :refer [test-var test-vars *current-env*]\n+                      :refer-macros [is testing deftest]])\n+            [clojure.test.check.generators :as gen]\n+            [com.gfredericks.test.chuck.clojure-test #?(:clj :refer :cljs :refer-macros) [checking]]))\n+\n+(deftest this-test-should-crash-and-be-caught\n+  (checking \"you can divide four by numbers\" 100 [i gen/pos-int]\n+    ;; going for uncaught-error-not-in-assertion here\n+    (let [n #?(:clj  (/ 4 i)\n+               :cljs (throw (js/Error. \"Oops!\")))]\n+      (is n))))\n+\n+(defn capture-test-var [v]\n+  (with-out-str (test-var v)))\n+\n+(deftest exception-detection-test\n+  (let [test-results\n+        #?(:clj\n+           (binding [; need to keep the failure of this-test-should-crash-and-be-caught\n+                     ; from affecting the clojure.test.check test run\n+                     *report-counters* (ref *initial-report-counters*)]\n+             (capture-test-var #'this-test-should-crash-and-be-caught)\n+             @*report-counters*)\n+\n+           :cljs\n+           (binding [*current-env* (test/empty-env)]\n+             (capture-test-var #'this-test-should-crash-and-be-caught)\n+             (:report-counters *current-env*)))]\n+    ;; should be reported as an error, but it's being reported as :fail :/\n+    (is (= {:pass 0\n+            :fail 1\n+            :error 0}\n+           (select-keys test-results [:pass :fail :error])))))\n+\n+(deftest this-test-should-fail\n+  (checking \"int equals 2\" 100 [i gen/pos-int]\n+    (is (= 2 i))))\n+\n+(deftest failure-detection-test\n+  (let [[test-results out]\n+        #?(:clj\n+           (binding [; need to keep the failure of this-test-should-fail from\n+                     ; affecting the clojure.test.check test run\n+                     *report-counters* (ref *initial-report-counters*)\n+                     *test-out* (java.io.StringWriter.)]\n+             (test-var #'this-test-should-fail)\n+             [@*report-counters* (str *test-out*)])\n+\n+           :cljs\n+           (binding [*current-env* (test/empty-env)]\n+             (capture-test-var #'this-test-should-fail)\n+             [(:report-counters *current-env*) nil]))]\n+    #?(:clj (is (not (re-find #\"not-falsey-or-exception\" out))))","path":"test/com/gfredericks/test/chuck/exception_handling_test.cljc","position":55,"original_position":55,"commit_id":"94180a7f648d688125f8113ef1e42503b0fe03a4","original_commit_id":"94180a7f648d688125f8113ef1e42503b0fe03a4","user":{"login":"gfredericks","id":135443,"avatar_url":"https://avatars.githubusercontent.com/u/135443?v=3","gravatar_id":"","url":"https://api.github.com/users/gfredericks","html_url":"https://github.com/gfredericks","followers_url":"https://api.github.com/users/gfredericks/followers","following_url":"https://api.github.com/users/gfredericks/following{/other_user}","gists_url":"https://api.github.com/users/gfredericks/gists{/gist_id}","starred_url":"https://api.github.com/users/gfredericks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfredericks/subscriptions","organizations_url":"https://api.github.com/users/gfredericks/orgs","repos_url":"https://api.github.com/users/gfredericks/repos","events_url":"https://api.github.com/users/gfredericks/events{/privacy}","received_events_url":"https://api.github.com/users/gfredericks/received_events","type":"User","site_admin":false},"body":"does `with-out-str` not work in cljs?","created_at":"2015-09-10T01:43:11Z","updated_at":"2015-09-10T01:43:11Z","html_url":"https://github.com/gfredericks/test.chuck/pull/15#discussion_r39117291","pull_request_url":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/gfredericks/test.chuck/pulls/comments/39117291"},"html":{"href":"https://github.com/gfredericks/test.chuck/pull/15#discussion_r39117291"},"pull_request":{"href":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15","id":41613286,"html_url":"https://github.com/gfredericks/test.chuck/pull/15","diff_url":"https://github.com/gfredericks/test.chuck/pull/15.diff","patch_url":"https://github.com/gfredericks/test.chuck/pull/15.patch","issue_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/15","number":15,"state":"open","locked":false,"title":"Add ClojureScript support (using cljc)","user":{"login":"nberger","id":81371,"avatar_url":"https://avatars.githubusercontent.com/u/81371?v=3","gravatar_id":"","url":"https://api.github.com/users/nberger","html_url":"https://github.com/nberger","followers_url":"https://api.github.com/users/nberger/followers","following_url":"https://api.github.com/users/nberger/following{/other_user}","gists_url":"https://api.github.com/users/nberger/gists{/gist_id}","starred_url":"https://api.github.com/users/nberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nberger/subscriptions","organizations_url":"https://api.github.com/users/nberger/orgs","repos_url":"https://api.github.com/users/nberger/repos","events_url":"https://api.github.com/users/nberger/events{/privacy}","received_events_url":"https://api.github.com/users/nberger/received_events","type":"User","site_admin":false},"body":"Alternative version of #14, with bump to clojure 1.7.0 to use reader conditionals.\r\n\r\n### Status\r\n\r\n- [x] test.chuck.properties\r\n- [x] test.chuck.generators (except double & regexes)\r\n- [x] test.chuck.clojure-test\r\n- [x] Implement a better test runner to avoid calling `(run-tests)` in each cljs test ns, and also to run tests in the browser.\r\n- [x] Improve `lein test-all` (and/or add a new \"test\" alias) to compensate the issue of leiningen not picking up `.cljc` files. The namespaces have to be explicitly enumerated. See technomancy/leiningen#1940","created_at":"2015-08-04T20:25:26Z","updated_at":"2015-09-10T01:43:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3abc036a6638aacf1d9a99f283c135c3c1f523b7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15/commits","review_comments_url":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15/comments","review_comment_url":"https://api.github.com/repos/gfredericks/test.chuck/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/15/comments","statuses_url":"https://api.github.com/repos/gfredericks/test.chuck/statuses/94180a7f648d688125f8113ef1e42503b0fe03a4","head":{"label":"nberger:cljc","ref":"cljc","sha":"94180a7f648d688125f8113ef1e42503b0fe03a4","user":{"login":"nberger","id":81371,"avatar_url":"https://avatars.githubusercontent.com/u/81371?v=3","gravatar_id":"","url":"https://api.github.com/users/nberger","html_url":"https://github.com/nberger","followers_url":"https://api.github.com/users/nberger/followers","following_url":"https://api.github.com/users/nberger/following{/other_user}","gists_url":"https://api.github.com/users/nberger/gists{/gist_id}","starred_url":"https://api.github.com/users/nberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nberger/subscriptions","organizations_url":"https://api.github.com/users/nberger/orgs","repos_url":"https://api.github.com/users/nberger/repos","events_url":"https://api.github.com/users/nberger/events{/privacy}","received_events_url":"https://api.github.com/users/nberger/received_events","type":"User","site_admin":false},"repo":{"id":40146612,"name":"test.chuck","full_name":"nberger/test.chuck","owner":{"login":"nberger","id":81371,"avatar_url":"https://avatars.githubusercontent.com/u/81371?v=3","gravatar_id":"","url":"https://api.github.com/users/nberger","html_url":"https://github.com/nberger","followers_url":"https://api.github.com/users/nberger/followers","following_url":"https://api.github.com/users/nberger/following{/other_user}","gists_url":"https://api.github.com/users/nberger/gists{/gist_id}","starred_url":"https://api.github.com/users/nberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nberger/subscriptions","organizations_url":"https://api.github.com/users/nberger/orgs","repos_url":"https://api.github.com/users/nberger/repos","events_url":"https://api.github.com/users/nberger/events{/privacy}","received_events_url":"https://api.github.com/users/nberger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nberger/test.chuck","description":"A utility library for test.check","fork":true,"url":"https://api.github.com/repos/nberger/test.chuck","forks_url":"https://api.github.com/repos/nberger/test.chuck/forks","keys_url":"https://api.github.com/repos/nberger/test.chuck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nberger/test.chuck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nberger/test.chuck/teams","hooks_url":"https://api.github.com/repos/nberger/test.chuck/hooks","issue_events_url":"https://api.github.com/repos/nberger/test.chuck/issues/events{/number}","events_url":"https://api.github.com/repos/nberger/test.chuck/events","assignees_url":"https://api.github.com/repos/nberger/test.chuck/assignees{/user}","branches_url":"https://api.github.com/repos/nberger/test.chuck/branches{/branch}","tags_url":"https://api.github.com/repos/nberger/test.chuck/tags","blobs_url":"https://api.github.com/repos/nberger/test.chuck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nberger/test.chuck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nberger/test.chuck/git/refs{/sha}","trees_url":"https://api.github.com/repos/nberger/test.chuck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nberger/test.chuck/statuses/{sha}","languages_url":"https://api.github.com/repos/nberger/test.chuck/languages","stargazers_url":"https://api.github.com/repos/nberger/test.chuck/stargazers","contributors_url":"https://api.github.com/repos/nberger/test.chuck/contributors","subscribers_url":"https://api.github.com/repos/nberger/test.chuck/subscribers","subscription_url":"https://api.github.com/repos/nberger/test.chuck/subscription","commits_url":"https://api.github.com/repos/nberger/test.chuck/commits{/sha}","git_commits_url":"https://api.github.com/repos/nberger/test.chuck/git/commits{/sha}","comments_url":"https://api.github.com/repos/nberger/test.chuck/comments{/number}","issue_comment_url":"https://api.github.com/repos/nberger/test.chuck/issues/comments{/number}","contents_url":"https://api.github.com/repos/nberger/test.chuck/contents/{+path}","compare_url":"https://api.github.com/repos/nberger/test.chuck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nberger/test.chuck/merges","archive_url":"https://api.github.com/repos/nberger/test.chuck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nberger/test.chuck/downloads","issues_url":"https://api.github.com/repos/nberger/test.chuck/issues{/number}","pulls_url":"https://api.github.com/repos/nberger/test.chuck/pulls{/number}","milestones_url":"https://api.github.com/repos/nberger/test.chuck/milestones{/number}","notifications_url":"https://api.github.com/repos/nberger/test.chuck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nberger/test.chuck/labels{/name}","releases_url":"https://api.github.com/repos/nberger/test.chuck/releases{/id}","created_at":"2015-08-03T20:34:25Z","updated_at":"2015-08-03T20:34:25Z","pushed_at":"2015-09-09T22:23:43Z","git_url":"git://github.com/nberger/test.chuck.git","ssh_url":"git@github.com:nberger/test.chuck.git","clone_url":"https://github.com/nberger/test.chuck.git","svn_url":"https://github.com/nberger/test.chuck","homepage":"","size":491,"stargazers_count":0,"watchers_count":0,"language":"Clojure","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":0,"default_branch":"master"}},"base":{"label":"gfredericks:master","ref":"master","sha":"4b90d75c423182bcce7b522e78305a86c4da50bc","user":{"login":"gfredericks","id":135443,"avatar_url":"https://avatars.githubusercontent.com/u/135443?v=3","gravatar_id":"","url":"https://api.github.com/users/gfredericks","html_url":"https://github.com/gfredericks","followers_url":"https://api.github.com/users/gfredericks/followers","following_url":"https://api.github.com/users/gfredericks/following{/other_user}","gists_url":"https://api.github.com/users/gfredericks/gists{/gist_id}","starred_url":"https://api.github.com/users/gfredericks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfredericks/subscriptions","organizations_url":"https://api.github.com/users/gfredericks/orgs","repos_url":"https://api.github.com/users/gfredericks/repos","events_url":"https://api.github.com/users/gfredericks/events{/privacy}","received_events_url":"https://api.github.com/users/gfredericks/received_events","type":"User","site_admin":false},"repo":{"id":18694088,"name":"test.chuck","full_name":"gfredericks/test.chuck","owner":{"login":"gfredericks","id":135443,"avatar_url":"https://avatars.githubusercontent.com/u/135443?v=3","gravatar_id":"","url":"https://api.github.com/users/gfredericks","html_url":"https://github.com/gfredericks","followers_url":"https://api.github.com/users/gfredericks/followers","following_url":"https://api.github.com/users/gfredericks/following{/other_user}","gists_url":"https://api.github.com/users/gfredericks/gists{/gist_id}","starred_url":"https://api.github.com/users/gfredericks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfredericks/subscriptions","organizations_url":"https://api.github.com/users/gfredericks/orgs","repos_url":"https://api.github.com/users/gfredericks/repos","events_url":"https://api.github.com/users/gfredericks/events{/privacy}","received_events_url":"https://api.github.com/users/gfredericks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gfredericks/test.chuck","description":"A utility library for test.check","fork":false,"url":"https://api.github.com/repos/gfredericks/test.chuck","forks_url":"https://api.github.com/repos/gfredericks/test.chuck/forks","keys_url":"https://api.github.com/repos/gfredericks/test.chuck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gfredericks/test.chuck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gfredericks/test.chuck/teams","hooks_url":"https://api.github.com/repos/gfredericks/test.chuck/hooks","issue_events_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/events{/number}","events_url":"https://api.github.com/repos/gfredericks/test.chuck/events","assignees_url":"https://api.github.com/repos/gfredericks/test.chuck/assignees{/user}","branches_url":"https://api.github.com/repos/gfredericks/test.chuck/branches{/branch}","tags_url":"https://api.github.com/repos/gfredericks/test.chuck/tags","blobs_url":"https://api.github.com/repos/gfredericks/test.chuck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gfredericks/test.chuck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gfredericks/test.chuck/git/refs{/sha}","trees_url":"https://api.github.com/repos/gfredericks/test.chuck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gfredericks/test.chuck/statuses/{sha}","languages_url":"https://api.github.com/repos/gfredericks/test.chuck/languages","stargazers_url":"https://api.github.com/repos/gfredericks/test.chuck/stargazers","contributors_url":"https://api.github.com/repos/gfredericks/test.chuck/contributors","subscribers_url":"https://api.github.com/repos/gfredericks/test.chuck/subscribers","subscription_url":"https://api.github.com/repos/gfredericks/test.chuck/subscription","commits_url":"https://api.github.com/repos/gfredericks/test.chuck/commits{/sha}","git_commits_url":"https://api.github.com/repos/gfredericks/test.chuck/git/commits{/sha}","comments_url":"https://api.github.com/repos/gfredericks/test.chuck/comments{/number}","issue_comment_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/comments{/number}","contents_url":"https://api.github.com/repos/gfredericks/test.chuck/contents/{+path}","compare_url":"https://api.github.com/repos/gfredericks/test.chuck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gfredericks/test.chuck/merges","archive_url":"https://api.github.com/repos/gfredericks/test.chuck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gfredericks/test.chuck/downloads","issues_url":"https://api.github.com/repos/gfredericks/test.chuck/issues{/number}","pulls_url":"https://api.github.com/repos/gfredericks/test.chuck/pulls{/number}","milestones_url":"https://api.github.com/repos/gfredericks/test.chuck/milestones{/number}","notifications_url":"https://api.github.com/repos/gfredericks/test.chuck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gfredericks/test.chuck/labels{/name}","releases_url":"https://api.github.com/repos/gfredericks/test.chuck/releases{/id}","created_at":"2014-04-12T02:09:57Z","updated_at":"2015-09-09T13:22:09Z","pushed_at":"2015-09-09T22:23:44Z","git_url":"git://github.com/gfredericks/test.chuck.git","ssh_url":"git@github.com:gfredericks/test.chuck.git","clone_url":"https://github.com/gfredericks/test.chuck.git","svn_url":"https://github.com/gfredericks/test.chuck","homepage":"","size":1279,"stargazers_count":59,"watchers_count":59,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":3,"forks":7,"open_issues":3,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15"},"html":{"href":"https://github.com/gfredericks/test.chuck/pull/15"},"issue":{"href":"https://api.github.com/repos/gfredericks/test.chuck/issues/15"},"comments":{"href":"https://api.github.com/repos/gfredericks/test.chuck/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/gfredericks/test.chuck/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gfredericks/test.chuck/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/gfredericks/test.chuck/statuses/94180a7f648d688125f8113ef1e42503b0fe03a4"}}}}