-
Notifications
You must be signed in to change notification settings - Fork 2
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 #2 from scicloj/fix-and-test-annotations
fixes and tests annotating kinds
- Loading branch information
Showing
4 changed files
with
121 additions
and
34 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: kindly-advice CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
|
||
clojure: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Prepare Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '8' | ||
|
||
- name: Install Clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest # Clojure CLI based on tools.deps | ||
|
||
# Optional step: | ||
- name: Cache Clojure dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
~/.gitlibs | ||
~/.deps.clj | ||
# List all files containing dependencies: | ||
key: cljdeps-${{ hashFiles('deps.edn') }} | ||
restore-keys: cljdeps- | ||
|
||
- name: Execute tests | ||
run: clojure -M:test -m cognitect.test-runner | ||
|
||
# TODO: for this to work: change myusername to a valid Clojars username, generate a token, add it as a secret in github project settings | ||
# - name: Deploy | ||
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'org.scicloj/kindly-advice' | ||
# env: | ||
# CLOJARS_PASSWORD: ${{ secrets.CLOJARSTOKEN }} | ||
# CLOJARS_USERNAME: myusername | ||
# run: clojure -T:build jar && clojure -T:build deploy |
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,13 +1,12 @@ | ||
{:deps {org.clojure/clojure {:mvn/version "1.10.3"} | ||
org.scicloj/kindly {:mvn/version "4-alpha3"}} | ||
:aliases {:dev {:extra-deps {org.scicloj/clay {:mvn/version "2-alpha32"} | ||
scicloj/tablecloth {:mvn/version "7.000-beta-51"}} | ||
:extra-paths ["notebooks"]} | ||
:build {:deps {io.github.seancorfield/build-clj | ||
{:git/tag "v0.6.4" :git/sha "c21cfde"}} | ||
{:deps {org.clojure/clojure {:mvn/version "1.11.1"}} | ||
:aliases {:dev {:extra-deps {org.scicloj/clay {:mvn/version "2-alpha32"} | ||
scicloj/tablecloth {:mvn/version "7.000-beta-51"}} | ||
:extra-paths ["test" "notebooks"]} | ||
;; Run tests with `clojure -T:build` | ||
:build {:deps {io.github.seancorfield/build-clj | ||
{:git/tag "v0.6.4" :git/sha "c21cfde"}} | ||
:ns-default build} | ||
:test {:extra-paths ["test"] | ||
:extra-deps {org.clojure/test.check {:mvn/version "1.1.1"} | ||
io.github.cognitect-labs/test-runner | ||
{:git/tag "v0.5.0" :git/sha "48c3c67"} | ||
org.scicloj/clay {:mvn/version "2-alpha32"}}}}} | ||
;; Run tests with `clojure -M:test -m cognitect.test-runner` | ||
:test {:extra-paths ["test"] | ||
:extra-deps {org.scicloj/kindly {:mvn/version "4-alpha7"} | ||
io.github.cognitect-labs/test-runner {:git/tag "v0.5.0" :git/sha "48c3c67"}}}}} |
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,33 @@ | ||
(ns scicloj.kindly-advice.v1.completion-test | ||
(:require [clojure.test :refer [deftest is testing]] | ||
[scicloj.kindly.v4.kind :as kind] | ||
[scicloj.kindly-advice.v1.completion :as kac])) | ||
|
||
(def table3 (kind/table {})) | ||
|
||
(def ^{:kindly/kind :kind/table} table4 {}) | ||
|
||
(def ^:kind/table table5 {}) | ||
|
||
|
||
(deftest meta-kind-test | ||
(testing "valid ways to annotate a kind" | ||
(is (= :kind/table (kac/meta-kind (kind/table {})))) | ||
(is (= :kind/table (kac/meta-kind ^{:kindly/kind :kind/table} {}))) | ||
(is (= :kind/table (kac/meta-kind ^{:kindly/kind kind/table} {}))) | ||
(is (= :kind/table (kac/meta-kind ^{:kindly/kind 'kind/table} {}))) | ||
(is (= :kind/table (kac/meta-kind ^{kind/table true} {}))) | ||
(is (= :kind/table (kac/meta-kind ^{'kind/table true} {}))) | ||
(is (= :kind/table (kac/meta-kind ^:kind/table {}))) | ||
(is (= :kind/table (kac/meta-kind ^kind/table {})))) | ||
(testing "invalid kinds" | ||
(is (= nil (kac/kind :kindly/table))) | ||
(is (= nil (kac/meta-kind ^:kindly/table {}))) | ||
(is (= nil (kac/kind 1))) | ||
(is (= nil (kac/meta-kind ^{:kindly/kind 1} {}))) | ||
(is (= nil (kac/meta-kind ^{:kindly/kind :not-a-kind} {})))) | ||
(testing "tricky kinds" | ||
(is (= :kind/table (kac/meta-kind table3))) | ||
(is (= :kind/table (kac/meta-kind #'table3))) | ||
(is (= :kind/table (kac/meta-kind #'table4))) | ||
(is (= :kind/table (kac/meta-kind #'table5))))) |