Converts last tests to test namespaces and write libraries.csv
This commit is contained in:
parent
0294923fbc
commit
23699de359
7 changed files with 126 additions and 46 deletions
58
doc/libraries.csv
Normal file
58
doc/libraries.csv
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
maven-name,git-url
|
||||||
|
aero/aero,http://github.com/juxt/aero
|
||||||
|
amperity/vault-clj,https://github.com/amperity/vault-clj
|
||||||
|
babashka/babashka.curl,https://github.com/babashka/babashka.curl
|
||||||
|
better-cond/better-cond,https://github.com/Engelberg/better-cond
|
||||||
|
borkdude/deps,https://github.com/borkdude/deps.clj
|
||||||
|
camel-snake-kebab/camel-snake-kebab,https://github.com/clj-commons/camel-snake-kebab
|
||||||
|
circleci/bond,https://github.com/circleci/bond
|
||||||
|
clj-commons/clj-yaml,https://github.com/clj-commons/clj-yaml
|
||||||
|
clj-commons/multigrep,https://github.com/clj-commons/multigrep
|
||||||
|
clojure-csv/clojure-csv,https://github.com/davidsantiago/clojure-csv
|
||||||
|
com.github.seancorfield/honeysql,https://github.com/seancorfield/honeysql
|
||||||
|
com.grammarly/omniconf,https://github.com/grammarly/omniconf
|
||||||
|
com.stuartsierra/component,https://github.com/stuartsierra/component
|
||||||
|
com.stuartsierra/dependency,https://github.com/stuartsierra/dependency
|
||||||
|
comb/comb,https://github.com/weavejester/comb
|
||||||
|
cprop/cprop,https://github.com/tolitius/cprop
|
||||||
|
crispin/crispin,https://github.com/dunaj-project/crispin
|
||||||
|
doric/doric,https://github.com/joegallo/doric
|
||||||
|
environ/environ,https://github.com/weavejester/environ
|
||||||
|
exoscale/coax,https://github.com/exoscale/coax
|
||||||
|
failjure/failjure,https://github.com/adambard/failjure
|
||||||
|
gaka/gaka,https://github.com/cdaddr/gaka
|
||||||
|
hato/hato,https://github.com/gnarroway/hato
|
||||||
|
henryw374/cljc.java-time,https://github.com/henryw374/cljc.java-time
|
||||||
|
hiccup/hiccup,http://github.com/weavejester/hiccup
|
||||||
|
honeysql/honeysql,https://github.com/seancorfield/honeysql
|
||||||
|
http-kit/http-kit,https://github.com/http-kit/http-kit
|
||||||
|
io.helins/binf,https://github.com/helins/binf.cljc
|
||||||
|
io.replikativ/hasch,https://github.com/replikativ/hasch
|
||||||
|
java-http-clj/java-http-clj,http://www.github.com/schmee/java-http-clj
|
||||||
|
lambdaisland/regal,https://github.com/lambdaisland/regal
|
||||||
|
listora/again,https://github.com/liwp/again
|
||||||
|
markdown-clj/markdown-clj,https://github.com/yogthos/markdown-clj
|
||||||
|
medley/medley,https://github.com/weavejester/medley
|
||||||
|
minimallist/minimallist,https://github.com/green-coder/minimallist
|
||||||
|
mvxcvi/arrangement,https://github.com/greglook/clj-arrangement
|
||||||
|
orchestra/orchestra,https://github.com/jeaye/orchestra
|
||||||
|
org.babashka/spec.alpha,https://github.com/babashka/spec.alpha
|
||||||
|
org.clj-commons/clj-http-lite,https://github.com/clj-commons/clj-http-lite
|
||||||
|
org.clj-commons/digest,https://github.com/clj-commons/clj-digest
|
||||||
|
org.clojars.askonomm/ruuter,https://github.com/askonomm/ruuter
|
||||||
|
org.clojure/core.match,https://github.com/clojure/core.match
|
||||||
|
org.clojure/data.csv,https://github.com/clojure/data.csv
|
||||||
|
org.clojure/data.generators,https://github.com/clojure/data.generators
|
||||||
|
org.clojure/data.json,https://github.com/clojure/data.json
|
||||||
|
org.clojure/data.zip,https://github.com/clojure/data.zip
|
||||||
|
org.clojure/math.combinatorics,https://github.com/clojure/math.combinatorics
|
||||||
|
org.clojure/test.check,https://github.com/clojure/test.check
|
||||||
|
org.clojure/tools.gitlibs,https://github.com/clojure/tools.gitlibs
|
||||||
|
org.clojure/tools.namespace,https://github.com/babashka/tools.namespace
|
||||||
|
reifyhealth/specmonstah,https://github.com/reifyhealth/specmonstah
|
||||||
|
rewrite-clj/rewrite-clj,https://github.com/clj-commons/rewrite-clj
|
||||||
|
rm-hull/jasentaa,https://github.com/rm-hull/jasentaa
|
||||||
|
selmer/selmer,https://github.com/yogthos/Selmer
|
||||||
|
slingshot/slingshot,https://github.com/scgilardi/slingshot
|
||||||
|
table/table,https://github.com/cldwalker/table
|
||||||
|
version-clj/version-clj,https://github.com/xsc/version-clj
|
||||||
|
|
|
@ -13,10 +13,12 @@
|
||||||
[clojure.edn :as edn]))
|
[clojure.edn :as edn]))
|
||||||
|
|
||||||
(deps/add-deps '{:deps {org.clojure/tools.gitlibs {:mvn/version "2.4.172"}
|
(deps/add-deps '{:deps {org.clojure/tools.gitlibs {:mvn/version "2.4.172"}
|
||||||
borkdude/rewrite-edn {:mvn/version "0.1.0"}}})
|
borkdude/rewrite-edn {:mvn/version "0.1.0"}
|
||||||
|
org.clojure/data.csv {:mvn/version "1.0.0"}}})
|
||||||
|
|
||||||
(require '[clojure.tools.gitlibs :as gl])
|
(require '[clojure.tools.gitlibs :as gl])
|
||||||
(require '[borkdude.rewrite-edn :as r])
|
(require '[borkdude.rewrite-edn :as r])
|
||||||
|
(require '[clojure.data.csv :as csv])
|
||||||
|
|
||||||
;; CLI Utils
|
;; CLI Utils
|
||||||
;; =========
|
;; =========
|
||||||
|
|
@ -153,6 +155,16 @@
|
||||||
:lib-coordinate (-> deps-map vals first)
|
:lib-coordinate (-> deps-map vals first)
|
||||||
:git-url (:git-url options)})))
|
:git-url (:git-url options)})))
|
||||||
|
|
||||||
|
(defn- write-lib-to-csv
|
||||||
|
"Updates libraries.csv with latest bb-tested-libs.edn"
|
||||||
|
[]
|
||||||
|
(let [libs (-> "test-resources/lib_tests/bb-tested-libs.edn" slurp edn/read-string)
|
||||||
|
rows (sort-by first
|
||||||
|
(map (fn [[name {:keys [git-url]}]]
|
||||||
|
[name git-url]) libs))]
|
||||||
|
(with-open [w (io/writer "doc/libraries.csv")]
|
||||||
|
(csv/write-csv w (into [["maven-name" "git-url"]] rows)))))
|
||||||
|
|
||||||
(defn- add-libtest*
|
(defn- add-libtest*
|
||||||
[args options]
|
[args options]
|
||||||
(let [[artifact-or-deps-string] args
|
(let [[artifact-or-deps-string] args
|
||||||
|
|
@ -164,6 +176,7 @@
|
||||||
dirs (when-not (:manually-added options) (copy-tests git-url lib-name options))
|
dirs (when-not (:manually-added options) (copy-tests git-url lib-name options))
|
||||||
namespaces (add-lib-to-tested-libs lib-name git-url dirs options)]
|
namespaces (add-lib-to-tested-libs lib-name git-url dirs options)]
|
||||||
(println "Added lib" lib-name "which tests the following namespaces:" namespaces)
|
(println "Added lib" lib-name "which tests the following namespaces:" namespaces)
|
||||||
|
(write-lib-to-csv)
|
||||||
(when (:test options)
|
(when (:test options)
|
||||||
(apply shell "script/lib_tests/run_all_libtests" namespaces))))
|
(apply shell "script/lib_tests/run_all_libtests" namespaces))))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,46 +25,13 @@
|
||||||
(str/lower-case)
|
(str/lower-case)
|
||||||
(str/includes? "win")))
|
(str/includes? "win")))
|
||||||
|
|
||||||
;;;; cprop
|
;; Standard test-runner for libtests
|
||||||
|
(let [lib-tests (edn/read-string (slurp (io/resource "bb-tested-libs.edn")))]
|
||||||
|
(doseq [{tns :test-namespaces skip-windows :skip-windows} (vals lib-tests)]
|
||||||
|
(when-not (and skip-windows windows?)
|
||||||
|
(apply test-namespaces tns))))
|
||||||
|
|
||||||
;; TODO: port to test-namespaces
|
;; Non-standard tests - These are tests with unusual setup around test-namespaces
|
||||||
|
|
||||||
(require '[cprop.core])
|
|
||||||
(require '[cprop.source :refer [from-env]])
|
|
||||||
(println (:cprop-env (from-env)))
|
|
||||||
|
|
||||||
;;;; clojure.data.zip
|
|
||||||
|
|
||||||
;; TODO: port to test-namespaces
|
|
||||||
|
|
||||||
(require '[clojure.data.xml :as xml])
|
|
||||||
(require '[clojure.zip :as zip])
|
|
||||||
(require '[clojure.data.zip.xml :refer [attr attr= xml1->]])
|
|
||||||
|
|
||||||
(def data (str "<root>"
|
|
||||||
" <character type=\"person\" name=\"alice\" />"
|
|
||||||
" <character type=\"animal\" name=\"march hare\" />"
|
|
||||||
"</root>"))
|
|
||||||
|
|
||||||
;; TODO: convert to test
|
|
||||||
(let [xml (zip/xml-zip (xml/parse (java.io.StringReader. data)))]
|
|
||||||
;(prn :xml xml)
|
|
||||||
(prn :alice-is-a (xml1-> xml :character [(attr= :name "alice")] (attr :type)))
|
|
||||||
(prn :animal-is-called (xml1-> xml :character [(attr= :type "animal")] (attr :name))))
|
|
||||||
|
|
||||||
;;;; deps.clj
|
|
||||||
|
|
||||||
;; TODO: port to test-namespaces
|
|
||||||
|
|
||||||
(require '[babashka.curl :as curl])
|
|
||||||
(spit "deps_test.clj"
|
|
||||||
(:body (curl/get "https://raw.githubusercontent.com/borkdude/deps.clj/master/deps.clj"
|
|
||||||
(if windows? {:compressed false} {}))))
|
|
||||||
|
|
||||||
(binding [*command-line-args* ["-Sdescribe"]]
|
|
||||||
(load-file "deps_test.clj"))
|
|
||||||
|
|
||||||
(.delete (io/file "deps_test.clj"))
|
|
||||||
|
|
||||||
;;;; doric
|
;;;; doric
|
||||||
|
|
||||||
|
|
@ -85,11 +52,6 @@
|
||||||
(require '[babashka.process] :reload)
|
(require '[babashka.process] :reload)
|
||||||
(test-namespaces 'babashka.process-test))
|
(test-namespaces 'babashka.process-test))
|
||||||
|
|
||||||
(let [lib-tests (edn/read-string (slurp (io/resource "bb-tested-libs.edn")))]
|
|
||||||
(doseq [{tns :test-namespaces skip-windows :skip-windows} (vals lib-tests)]
|
|
||||||
(when-not (and skip-windows windows?)
|
|
||||||
(apply test-namespaces tns))))
|
|
||||||
|
|
||||||
;;;; final exit code
|
;;;; final exit code
|
||||||
|
|
||||||
(let [{:keys [:test :fail :error] :as m} @status]
|
(let [{:keys [:test :fail :error] :as m} @status]
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,7 @@
|
||||||
amperity/vault-clj {:git-url "https://github.com/amperity/vault-clj", :test-namespaces [vault.lease-test vault.client.http-test], :manually-added true}
|
amperity/vault-clj {:git-url "https://github.com/amperity/vault-clj", :test-namespaces [vault.lease-test vault.client.http-test], :manually-added true}
|
||||||
orchestra/orchestra {:git-url "https://github.com/jeaye/orchestra", :test-namespaces (orchestra.make-fns orchestra.many-fns orchestra.expound-test orchestra.core-test orchestra.reload-test), :test-directories ("test/cljc" "test/clj"), :git-sha "81e5181f7b42e5e2763a2b37db17954f3be0314e"}
|
orchestra/orchestra {:git-url "https://github.com/jeaye/orchestra", :test-namespaces (orchestra.make-fns orchestra.many-fns orchestra.expound-test orchestra.core-test orchestra.reload-test), :test-directories ("test/cljc" "test/clj"), :git-sha "81e5181f7b42e5e2763a2b37db17954f3be0314e"}
|
||||||
;; BB-TEST-PATCH: Manually removed tasks.clj
|
;; BB-TEST-PATCH: Manually removed tasks.clj
|
||||||
org.clj-commons/clj-http-lite {:git-url "https://github.com/clj-commons/clj-http-lite", :test-namespaces (clj-http.lite.test-runner clj-http.lite.client-test), :test-directories ("bb"), :git-sha "6b53000df55ac05c4ff8e5047a5323fc08a52e8b"}}
|
org.clj-commons/clj-http-lite {:git-url "https://github.com/clj-commons/clj-http-lite", :test-namespaces (clj-http.lite.test-runner clj-http.lite.client-test), :test-directories ("bb"), :git-sha "6b53000df55ac05c4ff8e5047a5323fc08a52e8b"}
|
||||||
|
cprop/cprop {:git-url "https://github.com/tolitius/cprop", :test-namespaces [cprop.smoke-test], :manually-added true}
|
||||||
|
org.clojure/data.zip {:git-url "https://github.com/clojure/data.zip", :test-namespaces [clojure.data.zip-test], :manually-added true}
|
||||||
|
borkdude/deps {:git-url "https://github.com/borkdude/deps.clj", :test-namespaces [borkdude.deps.smoke-test], :manually-added true}}
|
||||||
|
|
|
||||||
20
test-resources/lib_tests/borkdude/deps/smoke_test.clj
Normal file
20
test-resources/lib_tests/borkdude/deps/smoke_test.clj
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
(ns borkdude.deps.smoke-test
|
||||||
|
(:require [clojure.test :as t :refer [deftest is]]
|
||||||
|
[clojure.java.io :as io]
|
||||||
|
[clojure.string :as str]
|
||||||
|
[babashka.curl :as curl]))
|
||||||
|
|
||||||
|
|
||||||
|
(def windows? (-> (System/getProperty "os.name")
|
||||||
|
(str/lower-case)
|
||||||
|
(str/includes? "win")))
|
||||||
|
|
||||||
|
(deftest basic-test
|
||||||
|
(spit "deps_test.clj"
|
||||||
|
(:body (curl/get "https://raw.githubusercontent.com/borkdude/deps.clj/master/deps.clj"
|
||||||
|
(if windows? {:compressed false} {}))))
|
||||||
|
|
||||||
|
(binding [*command-line-args* ["-Sdescribe"]]
|
||||||
|
(load-file "deps_test.clj"))
|
||||||
|
|
||||||
|
(.delete (io/file "deps_test.clj")))
|
||||||
17
test-resources/lib_tests/clojure/data/zip_test.clj
Normal file
17
test-resources/lib_tests/clojure/data/zip_test.clj
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
(ns clojure.data.zip-test
|
||||||
|
(:require [clojure.test :as t :refer [deftest is]]
|
||||||
|
[clojure.data.xml :as xml]
|
||||||
|
[clojure.zip :as zip]
|
||||||
|
[clojure.data.zip.xml :refer [attr attr= xml1->]]))
|
||||||
|
|
||||||
|
(def data (str "<root>"
|
||||||
|
" <character type=\"person\" name=\"alice\" />"
|
||||||
|
" <character type=\"animal\" name=\"march hare\" />"
|
||||||
|
"</root>"))
|
||||||
|
|
||||||
|
(deftest xml1-test
|
||||||
|
(let [xml (zip/xml-zip (xml/parse (java.io.StringReader. data)))]
|
||||||
|
(is (= "person"
|
||||||
|
(xml1-> xml :character [(attr= :name "alice")] (attr :type))))
|
||||||
|
(is (= "march hare"
|
||||||
|
(xml1-> xml :character [(attr= :type "animal")] (attr :name))))))
|
||||||
7
test-resources/lib_tests/cprop/smoke_test.clj
Normal file
7
test-resources/lib_tests/cprop/smoke_test.clj
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
(ns cprop.smoke-test
|
||||||
|
(:require [clojure.test :as t :refer [deftest is]]
|
||||||
|
[cprop.core]
|
||||||
|
[cprop.source :refer [from-env]]))
|
||||||
|
|
||||||
|
(deftest from-env-test
|
||||||
|
(println (:cprop-env (from-env))))
|
||||||
Loading…
Reference in a new issue