From d17a9e7163f3f156ae1e114c14ebb3e1fce56f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KARASZI=20Istv=C3=A1n?= Date: Sun, 29 Mar 2020 21:38:06 +0200 Subject: [PATCH] Re-enable kaocha.plugin.alpha/spec-test-check --- src/github_changelog/conventional.clj | 2 +- src/github_changelog/core.clj | 11 +++++------ src/github_changelog/git.clj | 2 +- src/github_changelog/semver.clj | 21 ++++++++++++++------- tests.edn | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/github_changelog/conventional.clj b/src/github_changelog/conventional.clj index 94da534..da04e17 100644 --- a/src/github_changelog/conventional.clj +++ b/src/github_changelog/conventional.clj @@ -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 []) diff --git a/src/github_changelog/core.clj b/src/github_changelog/core.clj index 73bcaaf..4205d5f 100644 --- a/src/github_changelog/core.clj +++ b/src/github_changelog/core.clj @@ -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) @@ -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?) @@ -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) diff --git a/src/github_changelog/git.clj b/src/github_changelog/git.clj index 9b91209..61a3e0d 100644 --- a/src/github_changelog/git.clj +++ b/src/github_changelog/git.clj @@ -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"))] diff --git a/src/github_changelog/semver.clj b/src/github_changelog/semver.clj index 45d5f77..393aa7d 100644 --- a/src/github_changelog/semver.clj +++ b/src/github_changelog/semver.clj @@ -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) @@ -45,6 +49,7 @@ (def valid? semver/valid?) (s/fdef valid? + :args (s/cat :v any?) :ret boolean?) (defn parse [version] @@ -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)) @@ -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) diff --git a/tests.edn b/tests.edn index a8c248c..11510a1 100644 --- a/tests.edn +++ b/tests.edn @@ -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]}