From bca75366795489b37c8612eddf786daa4a61158a Mon Sep 17 00:00:00 2001 From: Lee Read Date: Sun, 5 May 2024 15:18:47 -0400 Subject: [PATCH] Tests can now be generated from a header-less doc (#26) Fixed the summary report not accounting for the fact a doc might have no headers (aka section titles) in it. While this is an unlikely scenario for real docs, it is a likely one for someone wanting to give test-doc-blocks a whirl with a very minimal doc. Closes #25 --- CHANGELOG.adoc | 4 ++++ README.adoc | 1 + deps.edn | 3 ++- doc/contributors.edn | 3 ++- doc/generated/contributors/genmeblog.png | Bin 0 -> 12107 bytes src/lread/test_doc_blocks.clj | 3 ++- test-resources/doc/minimal.adoc | 5 +++++ test-resources/doc/minimal.md | 4 ++++ .../test-doc-blocks/test/minimal_adoc_test.cljc | 11 +++++++++++ .../test-doc-blocks/test/minimal_md_test.cljc | 11 +++++++++++ test/lread/test_doc_blocks_test.clj | 4 +++- 11 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 doc/generated/contributors/genmeblog.png create mode 100644 test-resources/doc/minimal.adoc create mode 100644 test-resources/doc/minimal.md create mode 100644 test-resources/expected/test-doc-blocks/test/minimal_adoc_test.cljc create mode 100644 test-resources/expected/test-doc-blocks/test/minimal_md_test.cljc diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 957dba6..cc8cae4 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -16,6 +16,10 @@ A release with known breaking changes is marked with: == Unreleased +* Tests can now be generated from a header-less doc +https://github.com/lread/test-doc-blocks/issues/25[#25] +(thanks for the feedback https://github.com/genmeblog[@genmeblog]!) + == v1.1.19 - 2024-05-02 [[v1.1.19]] * Drop `alpha` status, we don't have many users, but folks have been using this lib for years diff --git a/README.adoc b/README.adoc index 1294c24..d76325d 100644 --- a/README.adoc +++ b/README.adoc @@ -67,6 +67,7 @@ Test-doc-block versioning scheme is: `major`.`minor`.`release`-`test-qualifier` image:seancorfield.png[seancorfield,width=273,link="https://github.com/seancorfield"] image:MIJOTHY.png[MIJOTHY,width=273,link="https://github.com/MIJOTHY"] image:borkdude.png[borkdude,width=273,link="https://github.com/borkdude"] +image:genmeblog.png[genmeblog,width=273,link="https://github.com/genmeblog"] image:holyjak.png[holyjak,width=273,link="https://github.com/holyjak"] image:PEZ.png[PEZ,width=273,link="https://github.com/PEZ"] image:SevereOverfl0w.png[SevereOverfl0w,width=273,link="https://github.com/SevereOverfl0w"] diff --git a/deps.edn b/deps.edn index 78691f3..7897297 100644 --- a/deps.edn +++ b/deps.edn @@ -32,7 +32,8 @@ ;; but on Windows it can be very time consuming to learn how to escape them ;; sooo... I'm putting :docs here :test-opts {:exec-args {:docs ["doc/01-user-guide.adoc" - "doc/example.{adoc,md,cljc}"]}} + "doc/example.{adoc,md,cljc}" + "test-resources/doc/*.{adoc,md}"]}} ;; and :target, even passing a "\"string\"" is hard on windows :regen-opts {:exec-args {:target-root "test-resources/expected"}} diff --git a/doc/contributors.edn b/doc/contributors.edn index 6562abc..39bae9f 100644 --- a/doc/contributors.edn +++ b/doc/contributors.edn @@ -7,7 +7,8 @@ {:github-id "seancorfield" :contributions [:inspiration :feedback :testing]} {:github-id "uochan" :contributions [:feedback]} {:github-id "holyjak" :contributions [:docs]} - {:github-id "MIJOTHY" :contributions [:feedback :docs]}] + {:github-id "MIJOTHY" :contributions [:feedback :docs]} + {:github-id "genmeblog" :contributions [:feedback]}] :maintainers [{:github-id "lread" :contributions [:code]}]} diff --git a/doc/generated/contributors/genmeblog.png b/doc/generated/contributors/genmeblog.png new file mode 100644 index 0000000000000000000000000000000000000000..c7ae0fcc4053e4452fb221158ea92c58fe98e010 GIT binary patch literal 12107 zcmX|ncRbbo`~T4*$xgO9X2?zwDII$y4zl;28QC<9gK)@Rk-aHEeigF z=loPg5>ebszl=cKK**sUskZ_=~H0 z&J$jKep>sPp_dZPvsb)_jqmuZ{2H&bA3523aJ2fdN-}Y%Kr<~j|Ic8a`XBDkp(tdB zn?{iDG_stN*688zn$q8)@nE4oJUqNfLqnt1R+vsWX)Rcr6Du1o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U4!j-gq)Nzs#wzS)&Bu)^V1dp literal 0 HcmV?d00001 diff --git a/src/lread/test_doc_blocks.clj b/src/lread/test_doc_blocks.clj index 11483da..221b4e8 100644 --- a/src/lread/test_doc_blocks.clj +++ b/src/lread/test_doc_blocks.clj @@ -33,7 +33,8 @@ (doseq [[fname headers] fnames] (println (indent fname indent-cnt)) (doseq [[header lines] (->> headers (group-by :header) (into []) (sort-by #(-> % second first :line-no)))] - (println (indent header (+ 2 indent-cnt))) + (when header + (println (indent header (+ 2 indent-cnt)))) (doseq [line lines] (println (-> (format "%03d: %s" (:line-no line) (:test-doc-blocks/test-ns line)) (indent (+ 4 indent-cnt))))))))) diff --git a/test-resources/doc/minimal.adoc b/test-resources/doc/minimal.adoc new file mode 100644 index 0000000..e968388 --- /dev/null +++ b/test-resources/doc/minimal.adoc @@ -0,0 +1,5 @@ +[source,clojure] +---- +(+ 1 2) +;; => 3 +---- diff --git a/test-resources/doc/minimal.md b/test-resources/doc/minimal.md new file mode 100644 index 0000000..9f49898 --- /dev/null +++ b/test-resources/doc/minimal.md @@ -0,0 +1,4 @@ +```clojure +(+ 1 2) +;; => 3 +``` diff --git a/test-resources/expected/test-doc-blocks/test/minimal_adoc_test.cljc b/test-resources/expected/test-doc-blocks/test/minimal_adoc_test.cljc new file mode 100644 index 0000000..e29c1ee --- /dev/null +++ b/test-resources/expected/test-doc-blocks/test/minimal_adoc_test.cljc @@ -0,0 +1,11 @@ +(ns minimal-adoc-test + (:require clojure.test + clojure.string + #?(:cljs [lread.test-doc-blocks.runtime :include-macros]) + #?(:clj lread.test-doc-blocks.runtime))) + +(clojure.test/deftest block-0001 + (clojure.test/testing "test-resources/doc/minimal.adoc - line 2" +(clojure.test/is (= '3 (+ 1 2))))) + +(defn test-ns-hook [] (block-0001)) \ No newline at end of file diff --git a/test-resources/expected/test-doc-blocks/test/minimal_md_test.cljc b/test-resources/expected/test-doc-blocks/test/minimal_md_test.cljc new file mode 100644 index 0000000..d2cece2 --- /dev/null +++ b/test-resources/expected/test-doc-blocks/test/minimal_md_test.cljc @@ -0,0 +1,11 @@ +(ns minimal-md-test + (:require clojure.test + clojure.string + #?(:cljs [lread.test-doc-blocks.runtime :include-macros]) + #?(:clj lread.test-doc-blocks.runtime))) + +(clojure.test/deftest block-0001 + (clojure.test/testing "test-resources/doc/minimal.md - line 1" +(clojure.test/is (= '3 (+ 1 2))))) + +(defn test-ns-hook [] (block-0001)) \ No newline at end of file diff --git a/test/lread/test_doc_blocks_test.clj b/test/lread/test_doc_blocks_test.clj index 3d3be6c..fc9a330 100644 --- a/test/lread/test_doc_blocks_test.clj +++ b/test/lread/test_doc_blocks_test.clj @@ -18,7 +18,9 @@ (deftest verify-generation-against-known-good-run (sut/gen-tests {:docs ["doc/01-user-guide.adoc" - "doc/example.{adoc,md,cljc}"] + "doc/example.{adoc,md,cljc}" + "test-resources/doc/minimal.adoc" + "test-resources/doc/minimal.md"] :target-root "target/actual"}) (let [expected-dir "test-resources/expected/test-doc-blocks/test/"