Skip to content

Commit 56ea8ee

Browse files
mfikesdnolen
authored andcommitted
CLJS-2755: Can't generate uri instances
1 parent 27c27e0 commit 56ea8ee

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/main/cljs/cljs/spec/gen/alpha.cljs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
char double int keyword symbol string uuid delay])
1212
(:require-macros [cljs.core :as c]
1313
[cljs.spec.gen.alpha :as gen :refer [dynaload lazy-combinators lazy-prims]])
14-
(:require [cljs.core :as c]))
14+
(:require [cljs.core :as c])
15+
(:import (goog Uri)))
1516

1617
(deftype LazyVar [f ^:mutable cached]
1718
IDeref
@@ -107,6 +108,7 @@ gen-builtins
107108
simple-symbol? (symbol)
108109
qualified-symbol? (such-that qualified? (symbol-ns))
109110
uuid? (uuid)
111+
uri? (fmap #(Uri. (str "http://" % ".com")) (uuid))
110112
inst? (fmap #(js/Date. %)
111113
(large-integer))
112114
seqable? (one-of [(return nil)

src/test/cljs/cljs/spec/test_test.cljs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
(s/fdef clojure.core/symbol
88
:args (s/alt :separate (s/cat :ns string? :n string?)
9-
:str string?
10-
:sym symbol?)
9+
:str string?
10+
:sym symbol?)
1111
:ret symbol?)
1212

1313
(defn h-cljs-1812 [x] true)
@@ -82,3 +82,6 @@
8282
(is (= [1 2 3] (foo 1 2 3)))
8383
(is (thrown? js/Error (foo 1 :hello)))
8484
(stest/unstrument `foo))
85+
86+
(deftest test-2755
87+
(is (uri? (ffirst (s/exercise uri? 1)))))

0 commit comments

Comments
 (0)