-
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.
Merge pull request #5 from clasp-developers/tests
Adds tests and github automation for tests. Also fixes a buncha small bugs.
- Loading branch information
Showing
46 changed files
with
5,093 additions
and
121 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,66 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: ${{ matrix.host }} / ${{ matrix.mode }} | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
host: | ||
- sbcl # non-sbcl hosts would require more changes below | ||
mode: | ||
- native | ||
- cross | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Install SBCL | ||
if: matrix.host == 'sbcl' | ||
run: | | ||
sudo apt-get update | ||
sudo apt install -y sbcl | ||
- name: Install Quicklisp | ||
run: | | ||
curl -kLO https://beta.quicklisp.org/quicklisp.lisp | ||
sbcl --non-interactive --load quicklisp.lisp --eval "(quicklisp-quickstart:install)" --eval "(ql-util:without-prompting (ql:add-to-init-file))" | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: cvm | ||
|
||
# Clostrum is not in Quicklisp as of now, so get it from github. | ||
|
||
- name: Checkout Clostrum | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: s-expressionists/Clostrum | ||
path: Clostrum | ||
|
||
- name: Configure ASDF to find everything | ||
run: | | ||
mkdir -p $HOME/.config/common-lisp/source-registry.conf.d | ||
echo "(:TREE #P\"${{ github.workspace }}/\")" > $HOME/.config/common-lisp/source-registry.conf.d/cvm.conf | ||
- name: Run native client tests | ||
if: matrix.mode == 'native' | ||
run: | | ||
sbcl --load "${{ github.workspace }}/cvm/test/script.lisp" | ||
- name: Run cross client tests | ||
if: matrix.mode == 'cross' | ||
run: | | ||
sbcl --load "${{ github.workspace }}/cvm/test/cross/script.lisp" |
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,50 @@ | ||
(defpackage #:cvm.argparse | ||
(:use #:cl) | ||
(:export #:argument-error | ||
#:wrong-number-of-arguments #:odd-keywords | ||
#:unrecognized-keyword-argument) | ||
(:export #:parse-macro)) | ||
|
||
(in-package #:cvm.argparse) | ||
|
||
;;; abstract parent type for errors signaled by lambda list processing | ||
(define-condition argument-error (program-error) | ||
((%called-function :initform nil :initarg :called-function | ||
:reader called-function))) | ||
|
||
;;; nabbed from clasp | ||
(define-condition wrong-number-of-arguments (argument-error) | ||
((%given-nargs :initarg :given-nargs :reader given-nargs) | ||
(%min-nargs :initarg :min-nargs :reader min-nargs :initform nil) | ||
(%max-nargs :initarg :max-nargs :reader max-nargs :initform nil)) | ||
(:report (lambda (condition stream) | ||
(let* ((min (min-nargs condition)) | ||
(max (max-nargs condition)) | ||
;; FIXME: get an actual name if possible | ||
(dname nil)) | ||
(format stream "~@[Calling ~a - ~]Got ~d arguments, but expected ~@?" | ||
dname (given-nargs condition) | ||
(cond ((null max) "at least ~d") | ||
((null min) "at most ~*~d") | ||
;; I think "exactly 0" is better than "at most 0", thus duplication | ||
((= min max) "exactly ~d") | ||
((zerop min) "at most ~*~d") | ||
(t "between ~d and ~d")) | ||
min max))))) | ||
|
||
(define-condition odd-keywords (argument-error) | ||
() | ||
(:report (lambda (condition stream) | ||
(format stream "Odd number of keyword arguments~:[~; for ~s~]." | ||
(called-function condition) | ||
;; FIXME: again, get an actual name somehow. | ||
nil)))) | ||
|
||
(define-condition unrecognized-keyword-argument (argument-error) | ||
((%unrecognized-keywords :initarg :unrecognized-keywords | ||
:reader unrecognized-keywords)) | ||
(:report (lambda (condition stream) | ||
(format stream "Unrecognized keyword arguments ~S~:[~; for ~S~]." | ||
(unrecognized-keywords condition) | ||
(called-function condition) ; FIXME: name | ||
nil)))) |
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
Oops, something went wrong.