-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from liquidz/dev
Next release
- Loading branch information
Showing
9 changed files
with
216 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,51 @@ | ||
CP=$(shell clojure -A:dev -Spath) | ||
|
||
.PHONY: repl | ||
repl: | ||
iced repl -A:dev --with-kaocha --force-clojure-cli | ||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: repl-cljs | ||
repl-cljs: | ||
@npx nbb --classpath "$(shell clojure -A:dev -Spath)" nrepl-server | ||
|
||
.PHONY: inspect | ||
inspect: | ||
node --inspect target/js/compiled/index.js | ||
repl-cljs: ## Start cljs REPL via nbb | ||
@npx nbb --classpath "$(CP)" nrepl-server | ||
|
||
.PHONY: test | ||
test: test-clj test-bb test-cljs test-nbb | ||
test: test-clj test-bb test-cljs test-nbb ## Run all tests | ||
|
||
.PHONY: test-clj | ||
test-clj: | ||
test-clj: ## Run clj tests | ||
clojure -M:dev:1.9:test-clj | ||
clojure -M:dev:1.10:test-clj | ||
clojure -M:dev:test-clj | ||
|
||
.PHONY: test-bb | ||
test-bb: | ||
test-bb: ## Run babashka tests | ||
@bb --classpath "$(CP)" bb_test_runner.clj | ||
|
||
.PHONY: test-cljs | ||
test-cljs: | ||
test-cljs: ## Run cljs tests | ||
@clojure -M:dev:test-cljs | ||
|
||
.PHONY: test-nbb | ||
test-nbb: | ||
test-nbb: ## Run nbb tests | ||
@npx nbb --classpath "$(CP)" bb_test_runner.clj | ||
|
||
.PHONY: clean | ||
clean: | ||
clean: ## Clean | ||
rm -rf node_modules target .cpcache .clj-kondo/.cache | ||
|
||
.PHONY: lint | ||
lint: | ||
lint: ## Check lint errors and format errors | ||
clj-kondo --lint src:test | ||
cljstyle check | ||
|
||
.PHONY: outdated | ||
outdated: | ||
outdated: ## Show and upgrade outdated dependencies | ||
clojure -M:outdated --upgrade | ||
|
||
.PHONY: pom | ||
pom: | ||
clojure -T:build pom | ||
|
||
.PHONY: jar | ||
jar: | ||
clojure -T:build jar | ||
|
||
.PHONY: install | ||
install: clean | ||
install: clean ## Install jar to the local Maven repository | ||
clojure -T:build install | ||
|
||
.PHONY: deploy | ||
deploy: clean | ||
clojure -T:build deploy | ||
|
||
.PHONY: coverage | ||
coverage: | ||
coverage: ## Show coverage | ||
clojure -M:coverage:dev --src-ns-path=src --test-ns-path=test --codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
(ns bb-test-runner | ||
(:require | ||
[clojure.test :as t] | ||
[merr.core-test])) | ||
[merr.core-test] | ||
[merr.helper-test])) | ||
|
||
(t/run-tests 'merr.core-test) | ||
(t/run-tests 'merr.helper-test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
(ns merr.helper | ||
(:require | ||
[merr.core :as core])) | ||
|
||
(defn typed-error | ||
"Returns type specified `merr.core.MerrError` | ||
``` | ||
=> (def custom-error (partial typed-error ::custom)) | ||
var? | ||
=> (:type (custom-error)) | ||
::custom | ||
=> (:message (custom-error {:message \"hello\"})) | ||
\"hello\" | ||
```" | ||
([error-type] | ||
(typed-error error-type {})) | ||
([error-type {:as m :keys [message data cause]}] | ||
(core/error (assoc m :type error-type)))) | ||
|
||
(defn typed-error? | ||
"Returns `true` if x is type specified `merr.core.MerrError` | ||
``` | ||
=> (def custom-error? (partial typed-error? ::custom)) | ||
var? | ||
=> (custom-error? (merr.core/error {:type ::custom})) | ||
true | ||
=> (custom-error? (merr.core/error {:type ::another})) | ||
false | ||
=> (derive ::derived ::custom) | ||
nil | ||
=> (custom-error? (merr.core/error {:type ::derived})) | ||
true | ||
``` | ||
" | ||
[error-type err] | ||
(boolean | ||
(some-> (core/type err) | ||
(isa? error-type)))) |
Oops, something went wrong.