Skip to content

Commit e8e405c

Browse files
committed
nth-prime: Remove error handling
1 parent 07a3567 commit e8e405c

File tree

4 files changed

+3
-13
lines changed

4 files changed

+3
-13
lines changed

exercises/practice/nth-prime/.meta/example.clj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,4 @@
3636

3737
(defn nth-prime
3838
[n]
39-
(if (zero? n)
40-
(throw (IllegalArgumentException. "there is no zeroth prime"))
41-
(nth primes-seq (dec n))))
39+
(nth primes-seq (dec n)))

exercises/practice/nth-prime/.meta/generator.tpl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@
55
{{#test_cases.prime}}
66
(deftest nth-prime_test_{{idx}}
77
(testing {{context}}
8-
{{~#if error}}
9-
(is (thrown-with-msg? IllegalArgumentException #{{error}}
10-
(nth-prime/nth-prime {{input.number}})))))
11-
{{else}}
128
(is (= {{expected}} (nth-prime/nth-prime {{input.number}})))))
13-
{{/if~}}
149
{{/test_cases.prime}}

exercises/practice/nth-prime/.meta/tests.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ description = "big prime"
2323

2424
[bd0a9eae-6df7-485b-a144-80e13c7d55b2]
2525
description = "there is no zeroth prime"
26+
include = false
27+
comment = "excluded because we don't want to add error handling to the exercise"

exercises/practice/nth-prime/test/nth_prime_test.clj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,3 @@
1717
(deftest nth-prime_test_4
1818
(testing "big prime"
1919
(is (= 104743 (nth-prime/nth-prime 10001)))))
20-
21-
(deftest nth-prime_test_5
22-
(testing "there is no zeroth prime"
23-
(is (thrown-with-msg? IllegalArgumentException #"^there is no zeroth prime$"
24-
(nth-prime/nth-prime 0)))))

0 commit comments

Comments
 (0)