Skip to content

Commit

Permalink
Re-enable kaocha.plugin.alpha/spec-test-check
Browse files Browse the repository at this point in the history
  • Loading branch information
raszi committed Mar 29, 2020
1 parent 3c830ca commit d17a9e7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/github_changelog/conventional.clj
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
pulls
(conj pulls pull))))

(defn parse-changes [config {:keys [pulls] :as tag}]
(defn ^:no-gen parse-changes [config {:keys [pulls] :as tag}]
(->> (map (partial parse-pull config) pulls)
(remove nil?)
(reduce filter-reverted [])
Expand Down
11 changes: 5 additions & 6 deletions src/github_changelog/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(defn map-commits [tags git-repo]
(map (partial assoc-commits git-repo) tags))

(defn load-tags [config]
(defn ^:no-gen load-tags [config]
(let [git-repo (git/init config)
prefix (get config :tag-prefix "v")]
(-> (git/tags git-repo)
Expand All @@ -40,7 +40,7 @@
(defn find-pull [pulls sha]
(first (filter #(= (github/get-sha %) sha) pulls)))

(defn assoc-pulls [pulls {:keys [commits] :as tag}]
(defn ^:no-gen assoc-pulls [pulls {:keys [commits] :as tag}]
(->> commits
(map (partial find-pull pulls))
(remove nil?)
Expand All @@ -50,17 +50,16 @@
:args (s/cat :pulls (s/* ::github/pull) :tag ::core-spec/tag)
:ret ::core-spec/tag-with-pulls)

(defn collect-tags [config]
(defn ^:no-gen collect-tags [config]
(let [pulls (github/fetch-pulls config)]
(->> (load-tags config)
(map (partial assoc-pulls pulls)))))

(s/fdef collect-tags
:args (s/cat :config ::config/confg-map)
:args (s/cat :config ::config/config-map)
:ret (s/* ::core-spec/tag-with-pulls))


(defn changelog
(defn ^:no-gen changelog
"Fetches the changelog"
[config]
(->> (collect-tags config)
Expand Down
2 changes: 1 addition & 1 deletion src/github_changelog/git.clj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
(split-lines)
(first)))

(defn commits [dir from until]
(defn ^:no-gen commits [dir from until]
(let [commit (format "%s..%s"
(or from (initial-commit dir))
(or until "HEAD"))]
Expand Down
21 changes: 14 additions & 7 deletions src/github_changelog/semver.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
pre-release (str "-" pre-release)
build (str "+" build)))

(s/def ::major nat-int?)
(s/def ::minor nat-int?)
(s/def ::patch nat-int?)
(def nat-int (s/with-gen
nat-int?
#(gen/int)))

(s/def ::major nat-int)
(s/def ::minor nat-int)
(s/def ::patch nat-int)

(s/def ::pre-release (s/with-gen
(s/nilable ::spec/non-blank-string)
Expand Down Expand Up @@ -45,6 +49,7 @@
(def valid? semver/valid?)

(s/fdef valid?
:args (s/cat :v any?)
:ret boolean?)

(defn parse [version]
Expand Down Expand Up @@ -93,10 +98,10 @@

(def overrides
{::major #(s/gen pos-int?)
::minor #(s/gen zero?)
::patch #(s/gen zero?)
::pre-release #(s/gen nil?)
::build #(s/gen nil?)})
::minor #(gen/return 0)
::patch #(gen/return 0)
::pre-release #(gen/return nil)
::build #(gen/return nil)})

(defn- version-gen [overrides]
#(s/gen ::version overrides))
Expand Down Expand Up @@ -130,6 +135,8 @@
(s/exercise ::version-string)
(s/exercise ::version)

(s/exercise ::major)

(s/exercise ::major-version)
(s/exercise ::minor-version)
(s/exercise ::patch-version)
Expand Down
2 changes: 1 addition & 1 deletion tests.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
{:plugins [:kaocha.plugin/profiling
:kaocha.plugin/print-invocations
:kaocha.plugin/cloverage
#_:kaocha.plugin.alpha/spec-test-check]}
:kaocha.plugin.alpha/spec-test-check]}

0 comments on commit d17a9e7

Please sign in to comment.