run lib tests in Windows CI (#933)

* run lib tests in Windows CI

- add batch scripts for invoking tests
- skip some tests on windows
- tweak a couple tests to run on linux and windows

* configure git to checkout with Windows line endings on Appveyor
This commit is contained in:
Bob 2021-07-11 18:00:14 -04:00 committed by GitHub
parent b6e65c08a8
commit af6f94ef81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 12 deletions

View file

@ -17,6 +17,7 @@ cache:
- 'graalvm -> appveyor.yml'
clone_script:
- cmd: git config --global core.autocrlf true
- ps: >-
if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
git clone -q --branch=$env:APPVEYOR_REPO_BRANCH https://github.com/$env:APPVEYOR_REPO_NAME.git $env:APPVEYOR_BUILD_FOLDER
@ -71,6 +72,8 @@ build_script:
call script/test.bat
call script/run_lib_tests.bat
artifacts:
- path: babashka-*-windows-amd64.zip
name: babashka

View file

@ -0,0 +1,5 @@
if "%BABASHKA_TEST_ENV%" EQU "native" (set BB_CMD=.\bb) else (set BB_CMD=lein bb)
for /f %%i in ('.\bb clojure -A:lib-tests -Spath') do set BABASHKA_CLASSPATH=%%i
%BB_CMD% -cp "%BABASHKA_CLASSPATH%;test-resources/lib_tests" -f test-resources/lib_tests/babashka/run_all_libtests.clj %*

1
script/run_lib_tests.bat Normal file
View file

@ -0,0 +1 @@
call script/lib_tests/run_all_libtests.bat %* || exit /B 1

View file

@ -1,5 +1,6 @@
(ns babashka.run-all-libtests
(:require [clojure.java.io :as io]
[clojure.string :as str]
[clojure.test :as t]))
(def ns-args (set (map symbol *command-line-args*)))
@ -19,6 +20,10 @@
(swap! status (fn [status]
(merge-with + status (dissoc m :type))))))))
(def windows? (-> (System/getProperty "os.name")
(str/lower-case)
(str/includes? "win")))
;;;; clj-http-lite
(test-namespaces 'clj-http.lite.client-test)
@ -38,8 +43,8 @@
(prn (random-uuid))
;;;; babashka.curl
(test-namespaces 'babashka.curl-test)
; skip tests on Windows because of the :compressed thing
(when-not windows? (test-namespaces 'babashka.curl-test))
;;;; cprop
@ -114,7 +119,8 @@
(require '[babashka.curl :as curl])
(spit "deps_test.clj"
(:body (curl/get "https://raw.githubusercontent.com/borkdude/deps.clj/master/deps.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"))
@ -170,13 +176,13 @@
(test-namespaces 'httpkit.client-test)
;;;; babashka.process
(when-not windows?
;; test built-in babashka.process
(test-namespaces 'babashka.process-test)
;; test built-in babashka.process
(test-namespaces 'babashka.process-test)
;; test babashka.process from source
(require '[babashka.process] :reload)
(test-namespaces 'babashka.process-test)
;; test babashka.process from source
(require '[babashka.process] :reload)
(test-namespaces 'babashka.process-test))
(test-namespaces 'core-match.core-tests)

View file

@ -413,7 +413,7 @@
(is (= x (json/read-str (with-out-str (json/pprint x)))))))
(deftest pretty-print-nonescaped-unicode
(is (= "\"\u1234\u4567\"\n"
(is (= (str "\"\u1234\u4567\"" (System/lineSeparator))
(with-out-str
(json/pprint "\u1234\u4567" :escape-unicode false)))))

View file

@ -1048,7 +1048,7 @@
;; (is (nil? *custom-resource-path*)))
(deftest custom-resource-path-setting-url
(p/set-resource-path! (clojure.java.io/resource "templates/inheritance"))
(p/set-resource-path! "templates/inheritance")
#_(is (string? *custom-resource-path*))
(is (= (fix-line-sep "Hello, World!\n") (render-file "foo.html" {:name "World"})))
(p/set-resource-path! nil))
@ -1257,4 +1257,3 @@
"debug-value"))
(testing "basic rendering escapes HTML"
(is (str/includes? (basic-edn->html {:a "<pre>"}) "&quot"))))