Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CLJS-608: Stop re-seq after reaching end of string

  • Loading branch information...
commit e483c4a63560cd9df4c96722beaf390006e50b9e 1 parent 6906a56
Travis Thieman thieman authored swannodette committed
Showing with 4 additions and 1 deletion.
  1. +1 −1  src/cljs/cljs/core.cljs
  2. +3 −0  test/cljs/cljs/core_test.cljs
2  src/cljs/cljs/core.cljs
View
@@ -6564,7 +6564,7 @@ reduces them without incurring seq initialization"
match-idx (.search s re)
match-str (if (coll? match-data) (first match-data) match-data)
post-match (subs s (+ match-idx (count match-str)))]
- (when match-data (lazy-seq (cons match-data (re-seq re post-match))))))
+ (when match-data (lazy-seq (cons match-data (when (seq post-match) (re-seq re post-match)))))))
(defn re-pattern
"Returns an instance of RegExp which has compiled the provided string."
3  test/cljs/cljs/core_test.cljs
View
@@ -1960,5 +1960,8 @@
;; CLJS-600
(assert (= "foobar" (apply str (concat "foo" "bar"))))
+ ;; CLJS-608
+ (assert (= '("") (re-seq #"\s*" "")))
+
:ok
)
Please sign in to comment.
Something went wrong with that request. Please try again.