Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CLJS-724: Range -first bug

Don't return start if Range is empty
  • Loading branch information...
commit 69f3a390df4a954d49077bfd67200aac18d8cd99 1 parent 8943faf
@swannodette swannodette authored
Showing with 6 additions and 1 deletion.
  1. +2 −1  src/cljs/cljs/core.cljs
  2. +4 −0 test/cljs/cljs/core_test.cljs
View
3  src/cljs/cljs/core.cljs
@@ -6418,7 +6418,8 @@ reduces them without incurring seq initialization"
rng)))
ISeq
- (-first [rng] start)
+ (-first [rng]
+ (when-not (nil? (-seq rng)) start))
(-rest [rng]
(if-not (nil? (-seq rng))
(Range. meta (+ start step) end step nil)
View
4 test/cljs/cljs/core_test.cljs
@@ -2033,5 +2033,9 @@
(assert (= (apply list (drop-while (partial = 1) [1 2 3])) '(2 3)))
(assert (= (set (drop 1 #js [1 2 3])) #{2 3}))
+ ;; CLJS-724
+
+ (assert (nil? (first (rest (rest (rest (range 3)))))))
+
:ok
)
Please sign in to comment.
Something went wrong with that request. Please try again.