-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): initial setup for tests
This is an initial version of automated tests for Homestead, which will be very useful as the project is getting more complex and it’s hard to keep track of everything manually. I don’t fully understand how everything works yet, but it’s now running on CI in Github Actions. I got a lot of inspiration from this repo: renatoathaydes/lisp-site-gen. Also today, in Moscow, Alexei Navalny was buried. He was only 47 years old. It feels like such a tragic mistake that he is now dead, and the person who killed him is still president. I watched the live stream of the religious service and the burial, and it was extremely emotional to see how many people showed up, despite the risk. How many people changed “No to war”. How many more people could not be there. There’s a lot of us, and that makes me feel warm.
- Loading branch information
Showing
4 changed files
with
68 additions
and
1 deletion.
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,24 @@ | ||
### Adapted from: https://github.com/neil-lindquist/CI-Utils/blob/master/config-examples/.github/workflows/ci.yml | ||
name: CI | ||
|
||
# Github Actions allows for running jobs on a wide variety of events | ||
on: | ||
push: # Commits pushed to Github | ||
pull_request: # Pull request is update | ||
workflow_dispatch: # Manually dispatched from Github's UI | ||
|
||
jobs: | ||
test: | ||
name: "sbcl on ubuntu" | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
LISP: sbcl-bin | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: 40ants/setup-lisp@v4 | ||
with: | ||
asdf-system: homestead | ||
- uses: 40ants/run-tests@v2 | ||
with: | ||
asdf-system: homestead |
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,13 @@ | ||
(defpackage homestead/tests | ||
(:use :cl :fiveam) | ||
(:export :all-tests)) | ||
|
||
(in-package :homestead/tests) | ||
|
||
(def-suite all-tests :description "Top-level test suite for all tests.") | ||
|
||
(defun run-all! () | ||
(let ((ok (run! 'all-tests))) | ||
(if ok | ||
(format t "✅ All tests passed") | ||
(error "❌ At least one suite failed")))) |
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,20 @@ | ||
(defpackage homestead/tests/util | ||
(:use :cl :fiveam) | ||
(:export :util-test-suite :|util-test-suite|)) | ||
|
||
(in-package :homestead/tests/util) | ||
|
||
(def-suite | ||
util-test-suite | ||
:description "Util test suite" | ||
:in homestead/tests:all-tests) | ||
(in-suite util-test-suite) | ||
|
||
(test join | ||
(let ((list '("a" "b"))) | ||
(is (string= (homestead/util:join list) "a, b")) | ||
(is (string= (homestead/util:join list " | ") "a | b")))) | ||
|
||
(test slurp | ||
(let ((missing-file "/tmp/bob.txt")) | ||
(is (equal '() (homestead/util:slurp missing-file))))) |