From 2ad7d96945bcc3ec0ae683c2f46cdafa403b443e Mon Sep 17 00:00:00 2001 From: Jose Gomez Date: Sun, 1 Sep 2024 08:02:37 -0500 Subject: [PATCH] feat: initial commit of empty hierarchy library --- .clj-kondo/.gitkeep | 0 .clj-kondo/config.edn | 1 + .github/workflows/clojure.yml | 31 +++ .gitignore | 20 ++ CHANGELOG.md | 4 + CONTRIBUTING.md | 39 ++++ CONTRIBUTORS.md | 5 + LICENSE | 202 ++++++++++++++++++ Makefile | 31 +++ NOTICE | 13 ++ README.md | 57 +++++ RELEASE.md | 18 ++ bin/kaocha | 2 + deps.edn | 51 +++++ dev/user.clj | 8 + pom.xml | 37 ++++ resources/.gitkeep | 0 .../hierarchy/hierarchy/config.edn | 1 + src/hierarchy/core.clj | 1 + test/hierarchy/core_test.clj | 12 ++ test/hierarchy/test_setup.clj | 18 ++ tests.edn | 13 ++ 22 files changed, 564 insertions(+) create mode 100644 .clj-kondo/.gitkeep create mode 100644 .clj-kondo/config.edn create mode 100644 .github/workflows/clojure.yml create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 CONTRIBUTORS.md create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 NOTICE create mode 100644 README.md create mode 100644 RELEASE.md create mode 100755 bin/kaocha create mode 100644 deps.edn create mode 100644 dev/user.clj create mode 100644 pom.xml create mode 100644 resources/.gitkeep create mode 100644 resources/clj-kondo.exports/hierarchy/hierarchy/config.edn create mode 100644 src/hierarchy/core.clj create mode 100644 test/hierarchy/core_test.clj create mode 100644 test/hierarchy/test_setup.clj create mode 100644 tests.edn diff --git a/.clj-kondo/.gitkeep b/.clj-kondo/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn new file mode 100644 index 0000000..82355b7 --- /dev/null +++ b/.clj-kondo/config.edn @@ -0,0 +1 @@ +{:config-paths ["../resources/clj-kondo.exports/hierarchy/hierarchy"]} diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml new file mode 100644 index 0000000..f18a73a --- /dev/null +++ b/.github/workflows/clojure.yml @@ -0,0 +1,31 @@ +name: Clojure CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Setup Java + uses: actions/setup-java@v3 + with: + # see: https://github.com/marketplace/actions/setup-java + distribution: 'corretto' + java-version: '11' + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@12.1 + with: + # see: https://github.com/marketplace/actions/setup-clojure + cli: 1.11.1.1429 + - name: Run tests + run: make test + - name: Run clj-kondo linter + run: make lint + - name: Run build jar + run: make clean build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9785cd2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +/build +/target +/lib +/classes +/checkouts +/resources/public/js/* +pom.xml.asc +*.jar +*.class +.lein-deps-sum +.lein-failures +.lein-plugins +.lein-repl-history +figwheel_server.log +*.*~ +.idea/* +*.iml +.clj-kondo +.lsp +.cpcache diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d69a003 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +This is a history of changes to k13labs/hierarchy + +# 0.1.0 +* The initial release. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2ef1143 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing + +Help us to make this project better by contributing. Whether it's new features, bug fixes, or simply improving documentation, your contributions are welcome. Please start with logging a [github issue][1] or submit a pull request. + +Before you contribute, please review these guidelines to help ensure a smooth process for everyone. + +Thanks. + +## Issue reporting + +* Please browse our [existing issues][1] before logging new issues. +* Check that the issue has not already been fixed in the `main` branch. +* Open an issue with a descriptive title and a summary. +* Please be as clear and explicit as you can in your description of the problem. +* Please state the specific library versions you are using in the description. +* Include any relevant code in the issue summary. + +## Pull requests + +* Read [how to properly contribute to open source projects on Github][2]. +* Fork the project. +* Use a feature branch. +* Write [good commit messages][3]. +* Use the same coding conventions as the rest of the project. +* Commit locally and push to your fork until you are happy with your contribution. +* Make sure to add tests and verify all the tests are passing when merging upstream. +* Add an entry to the [Changelog][4] accordingly. +* Please add your name to the CONTRIBUTORS.md file. Adding your name to the CONTRIBUTORS.md file signifies agreement to all rights and reservations provided by the [License][5]. +* [Squash related commits together][6]. +* Open a [pull request][7]. +* The pull request will be reviewed by the community and merged by the project committers. + +[1]: https://github.com/k13labs/hierarchy/issues +[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request +[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[4]: ./CHANGELOG.md +[5]: ./LICENSE +[6]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html +[7]: https://help.github.com/articles/using-pull-requests diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..988c1eb --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +Hierarchy Contributors + +- Jose Gomez [@k13gomez] + +[@k13gomez]: https://github.com/k13gomez diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d6aff6b --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +.PHONY: repl test clean deploy install format-check format-fix + +SHELL := /bin/bash + +repl: + clojure -M:dev:test:repl + +test: + clojure -M:dev:test:runner --focus :unit --reporter kaocha.report/documentation --no-capture-output + +clean: + rm -rf target build + +lint: + clojure -M:dev:test:clj-kondo --copy-configs --dependencies --parallel --lint "$(shell clojure -A:dev:test -Spath)" + clojure -M:dev:test:clj-kondo --lint "src:test" --fail-level "error" + +build: + clojure -X:jar :sync-pom true + +deploy: clean build + clojure -X:deploy-maven + +install: + clojure -X:install-maven + +format-check: + clojure -M:format-check + +format-fix: + clojure -M:format-fix diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..eb678af --- /dev/null +++ b/NOTICE @@ -0,0 +1,13 @@ +Copyright 2024 Jose Gomez + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..96d6c67 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +[![Build Status](https://github.com/k13labs/hierarchy/actions/workflows/clojure.yml/badge.svg)](https://github.com/k13labs/hierarchy/actions/workflows/clojure.yml) + +# _About_ + +hierarchy is a Clojure library for primarily designed to enhance the built-in hierarchy functions in Clojure, in order to more freely support the use of a variety of value types when calling derive/underive. + +# _Usage_ + +Here's a simple example. + +```clj +(ns user + (:require [hierarchy.core :as h])) + +``` + +See the existing tests for more examples. + +# _Building_ + +hierarchy is built, tested, and deployed using [Clojure Tools Deps](https://clojure.org/guides/deps_and_cli). + +GNU Make is used to simplify invocation of some commands. + +# _Availability_ + +hierarchy releases for this project are on [Clojars](https://clojars.org/). Simply add the following to your project: + +[![Clojars Project](http://clojars.org/com.github.k13labs/hierarchy/latest-version.svg)](http://clojars.org/com.github.k13labs/hierarchy) + +# _Communication_ + +- For any other questions or issues about hierarchy free to browse or open a [Github Issue](https://github.com/k13labs/hierarchy/issues). + +# Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md) + +# YourKit + +[![YourKit](https://www.yourkit.com/images/yklogo.png)](https://www.yourkit.com/) + +YourKit supports open source projects with innovative and intelligent tools +for monitoring and profiling Java and .NET applications. +YourKit is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), +[YourKit .NET Profiler](https://www.yourkit.com/dotnet-profiler/), +and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/). + +# LICENSE + +Copyright 2024 Jose Gomez + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +    http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..1e0b201 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,18 @@ +# How to Release + +This project is hosted on [Clojars][clojars]. You can see it [here][release-site]. + +Releasing the project requires these steps: + +1. Run ```make test``` to ensure everything is working as expected. +2. Set the version number and tag in the `pom.xml` file, commit the changes. +3. Use a GitHub [project release][github-release-url] to release the project and tag (be sure it follows [semver][semantic-versioning]) +4. Run ```make clean build``` to test building the project, commit any changes to the `pom.xml` file. +5. Run ```make deploy``` to deploy the project to the Clojars repository. +6. Update the `pom.xml` in `main` to a new minor version, commit the changes. + +[clojars]: https://clojars.org +[release-site]: https://clojars.org/com.github.k13labs/hierarchy +[project-url]: https://github.com/k13labs/hierarchy/ +[semantic-versioning]: http://semver.org/ +[github-release-url]: https://help.github.com/articles/creating-releases/ diff --git a/bin/kaocha b/bin/kaocha new file mode 100755 index 0000000..4c19821 --- /dev/null +++ b/bin/kaocha @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +clojure -M:dev:test:runner $@ diff --git a/deps.edn b/deps.edn new file mode 100644 index 0000000..6bb56e0 --- /dev/null +++ b/deps.edn @@ -0,0 +1,51 @@ +{:paths ["src" "resources"] + :deps {org.clojure/clojure {:mvn/version "1.11.2"}} + + ;for more examples of aliases see: https://github.com/seancorfield/dot-clojure + :aliases + {:dev {:extra-paths ["dev"] + :extra-deps {reloaded.repl/reloaded.repl {:mvn/version "0.2.4"} + criterium/criterium {:mvn/version "0.4.6"}}} + + :clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2023.12.15"}} + :main-opts ["-m" "clj-kondo.main"]} + + :test {:extra-paths ["test"] + :extra-deps {lambdaisland/kaocha {:mvn/version "1.80.1274"} + org.clojure/test.check {:mvn/version "1.1.1"} + org.slf4j/slf4j-simple {:mvn/version "2.0.11"} + pjstadig/humane-test-output {:mvn/version "0.10.0"}}} + + :runner {:main-opts ["-e" "(println \"warn-on-reflection =\" (set! *warn-on-reflection* true))" + "-m" "kaocha.runner"] + :exec-fn kaocha.runner/exec-fn} + + + :repl {:extra-deps {nrepl/nrepl {:mvn/version "1.1.0"} + cider/cider-nrepl {:mvn/version "0.44.0"}} + :main-opts ["-e" "(println \"warn-on-reflection =\" (set! *warn-on-reflection* true))" + "-m" "nrepl.cmdline" "--interactive" + "--middleware" "[\"cider.nrepl/cider-middleware\"]"]} + + :format-fix {:extra-deps {cljfmt/cljfmt {:mvn/version "0.9.2"}} + :main-opts ["-m" "cljfmt.main" "fix" "src" "dev"]} + + :format-check {:extra-deps {cljfmt/cljfmt {:mvn/version "0.9.2"}} + :main-opts ["-m" "cljfmt.main" "check" "src" "dev"]} + + :jar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.0.216"}} + :exec-fn hf.depstar/jar + :exec-args {:jar "build/hierarchy.jar"}} + + :install-maven {:extra-deps {slipset/deps-deploy {:mvn/version "0.1.5"}} + :exec-fn deps-deploy.deps-deploy/deploy + :exec-args {:installer :local + :artifact "build/hierarchy.jar"}} + + :deploy-maven {:replace-deps {slipset/deps-deploy {:mvn/version "0.1.5"}} + :exec-fn deps-deploy.deps-deploy/deploy + :exec-args {:installer :remote + :artifact "build/hierarchy.jar"}}} + :mvn/repos + {"central" {:url "https://repo1.maven.org/maven2/"} + "clojars" {:url "https://repo.clojars.org/"}}} diff --git a/dev/user.clj b/dev/user.clj new file mode 100644 index 0000000..112e4f1 --- /dev/null +++ b/dev/user.clj @@ -0,0 +1,8 @@ +(ns user + (:require [criterium.core :refer [report-result + quick-benchmark] :as crit])) + +(comment + (add-tap #'println) + (remove-tap #'println) + (tap> "foobar")) diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..bae1211 --- /dev/null +++ b/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + jar + com.github.k13labs + hierarchy + hierarchy + 1.0.3 + + 1.0.3 + https://github.com/k13labs/hierarchy + scm:git:git://github.com/k13labs/hierarchy.git + scm:git:ssh://git@github.com/k13labs/hierarchy.git + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + org.clojure + clojure + 1.11.2 + + + + src + + + + clojars + https://repo.clojars.org/ + + + diff --git a/resources/.gitkeep b/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/resources/clj-kondo.exports/hierarchy/hierarchy/config.edn b/resources/clj-kondo.exports/hierarchy/hierarchy/config.edn new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/resources/clj-kondo.exports/hierarchy/hierarchy/config.edn @@ -0,0 +1 @@ +{} diff --git a/src/hierarchy/core.clj b/src/hierarchy/core.clj new file mode 100644 index 0000000..541ba87 --- /dev/null +++ b/src/hierarchy/core.clj @@ -0,0 +1 @@ +(ns hierarchy.core) diff --git a/test/hierarchy/core_test.clj b/test/hierarchy/core_test.clj new file mode 100644 index 0000000..f5d69bd --- /dev/null +++ b/test/hierarchy/core_test.clj @@ -0,0 +1,12 @@ +(ns hierarchy.core-test + (:require [clojure.test :refer [deftest testing is use-fixtures]] + [hierarchy.core :as h] + [criterium.core :refer [report-result + quick-benchmark + with-progress-reporting]])) + +(defn hierarchy-fixture + [f] + (f)) + +(use-fixtures :once hierarchy-fixture) diff --git a/test/hierarchy/test_setup.clj b/test/hierarchy/test_setup.clj new file mode 100644 index 0000000..ec895a4 --- /dev/null +++ b/test/hierarchy/test_setup.clj @@ -0,0 +1,18 @@ +(ns hierarchy.test-setup + "Things we need to do in order to run tests with a smile" + (:require [kaocha.hierarchy :as hierarchy] + [pjstadig.humane-test-output :as hto])) + +(hierarchy/derive! ::ignore :kaocha/known-key) + +(hto/activate!) + +#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} +(defn defuse-zero-assertions + "Don't fail the test suite if we hide an `is` within a `doseq`. + + See also https://cljdoc.org/d/lambdaisland/kaocha/1.80.1274/doc/-clojure-test-assertion-extensions#detecting-missing-assertions" + [event] + (if (= (:type event) :kaocha.type.var/zero-assertions) + (assoc event :type ::ignore) + event)) diff --git a/tests.edn b/tests.edn new file mode 100644 index 0000000..2683a16 --- /dev/null +++ b/tests.edn @@ -0,0 +1,13 @@ +#kaocha/v1 {:capture-output? true + :kaocha/fail-fast? false + :plugins [:kaocha.plugin/profiling + :kaocha.plugin/print-invocations + :kaocha.plugin/hooks + :preloads] + :kaocha.hooks/pre-report [hierarchy.test-setup/defuse-zero-assertions] + :kaocha.plugin.preloads/ns-names [hierarchy.test-setup] + :tests [{:id :unit + :kaocha/fail-fast? false + :kaocha/source-paths ["src"] + :kaocha/test-paths ["test"] + :ns-patterns [".*"]}]}