forked from johanlindberg/doctest
-
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 #4 from simendsjo/portable-common-lisp
v0.3
- Loading branch information
Showing
8 changed files
with
268 additions
and
93 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,30 @@ | ||
on: [push] | ||
jobs: | ||
tests: | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
# - macos-latest | ||
# - windows-latest | ||
lisp: | ||
- sbcl-bin | ||
# - ecl | ||
# - ccl-bin | ||
# - abcl-bin | ||
# - clasp-bin | ||
# - cmu-bin | ||
# - clisp-head | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
LISP: ${{ matrix.lisp }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: 40ants/setup-lisp@v4 | ||
with: | ||
asdf-system: sijo-doctest | ||
qlfile-template: | | ||
dist ultralisp http://dist.ultralisp.org | ||
- uses: 40ants/run-tests@v2 | ||
with: | ||
asdf-system: sijo-doctest |
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,17 +1,18 @@ | ||
*.FASL | ||
*.fasl | ||
*.lisp-temp | ||
*.dfsl | ||
*.pfsl | ||
*.d64fsl | ||
*.p64fsl | ||
*.lx64fsl | ||
*.lx32fsl | ||
*.dx64fsl | ||
*.dx32fsl | ||
*.fx64fsl | ||
*.fx32fsl | ||
*.sx64fsl | ||
*.sx32fsl | ||
*.wx64fsl | ||
*.wx32fsl | ||
*.FASL | ||
*.fasl | ||
*.fas | ||
*.lisp-temp | ||
*.dfsl | ||
*.pfsl | ||
*.d64fsl | ||
*.p64fsl | ||
*.lx64fsl | ||
*.lx32fsl | ||
*.dx64fsl | ||
*.dx32fsl | ||
*.fx64fsl | ||
*.fx32fsl | ||
*.sx64fsl | ||
*.sx32fsl | ||
*.wx64fsl | ||
*.wx32fsl |
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,43 @@ | ||
* Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [[https://keepachangelog.com/en/1.1.0][Keep a Changelog]], and this project *DOES NOT* adhere to [[https://semver.org/spec/v2.0.0.html][Semantic | ||
Versioning]]. | ||
|
||
** [[https://github.com/simendsjo/sijo-doctest/compare/v0.2..v0.3][0.3.0]] - 2024-03-11 | ||
*** Added | ||
- Support Embedded Common Lisp (ECL) | ||
- Support Clozure Common Lisp (CCL) | ||
- Support Armed Bear Common Lisp (ABCL) | ||
- ~test-docstring~ for testing strings -- simplifies testing | ||
- ~test-variable~ for testing variables | ||
*** Changed | ||
- Don't require an exact error, but rather a subclass of the expected error, | ||
e.g. expecting ~type-error~ will allow a subclass like ~simple-type-error~. | ||
- The general ~test~ is exported | ||
- ~test~ runs ~test-package~ for ~package~ | ||
- ~test~ supports ~null~ | ||
- ~test~ supports ~string~ | ||
- ~test~ for symbol will test both variable and function/macro bound to that symbol | ||
- Number of failed/passed tests is always returned, also when there are no | ||
doctests for a thing, rather than ~nil~ | ||
*** Deprecated | ||
*** Removed | ||
*** Fixed | ||
- ~test-package~ only includes symbols for the package under test | ||
- ~test-package~ works for macros | ||
*** Security | ||
|
||
** [[https://github.com/simendsjo/sijo-doctest/commit/039516e828b5737569350a13ffc90c2d8346ad8c][0.2.0]] - 2024-03-01 | ||
*** Added | ||
- ~test-package~ function to test all functions in a package | ||
*** Changed | ||
- Tweaked to evaluate expected results to avoid problems with ~fset~ and | ||
readtables; ~#{||}~ cannot be used, and ~(fset:empty-map)~ neither | ||
- Improved working with multiple values | ||
- Print only when tests are failing (useful when testing entire packages) | ||
*** Deprecated | ||
*** Removed | ||
*** Fixed | ||
- ~run-doctests~ doesn't throw on empty docstring (triggered eof error) | ||
*** Security |
File renamed without changes.
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,5 +1,10 @@ | ||
Doctests for Lisp | ||
[[https://github.com/simendsjo/sijo-doctest/actions/workflows/tests.yaml/badge.svg][Build badge]] | ||
|
||
* Doctests for Lisp | ||
|
||
See [[file:CHANGELOG.org][CHANGELOG]]. | ||
|
||
** Installation | ||
Clone repository | ||
#+begin_src bash | ||
git clone [email protected]:simendsjo/sijo-doctest.git ~/quicklisp/local-projects/sijo-doctest | ||
|
@@ -10,6 +15,7 @@ Load library | |
(ql:quickload :sijo-doctest) | ||
#+end_src | ||
|
||
** Usage | ||
Write some doctests | ||
#+begin_src lisp | ||
(defun square (x) | ||
|
@@ -24,27 +30,12 @@ Write some doctests | |
(* x x)) | ||
#+end_src | ||
|
||
See [[file:doctest.lisp::defun test (thing &key (output t)][doctest.lisp::test]] for full documentation or look at the documentation for | ||
the function directly | ||
#+begin_src lisp :wrap quote :exports both | ||
(documentation 'sijo-doctest::test 'function) | ||
#+end_src | ||
|
||
#+RESULTS: | ||
#+begin_quote | ||
Test extracts and tests code snippets embedded in the documentation string | ||
of <thing>. It returns the number of tests failed and passed and prints a | ||
description to <output>. | ||
|
||
In order to have...[sly-elided string of length 3067] | ||
#+end_quote | ||
|
||
Test your package | ||
#+begin_src lisp | ||
(sijo-doctest:test-package :your-own-package) | ||
#+end_src | ||
|
||
* Documentation for ~sijo-doctest::test~ | ||
** Documentation for ~sijo-doctest::test~ | ||
|
||
Warning: This is bound to get out of date, so look at the documentation in the source. | ||
|
||
|
@@ -80,13 +71,16 @@ Test extracts and tests code snippets embedded in the documentation string | |
2) (values 1 2) instead. | ||
|
||
If you test a thing that doesn't have a documentation string, test will | ||
return NIL. | ||
return (values 0 0). | ||
ECL NOTE: I pass an empty string here as redefining a function in ECL won't | ||
remove the old docstring unless a docstring is explicitly passed. | ||
|
||
>> (defun sqr (x) | ||
"" | ||
(* x x)) | ||
'SQR | ||
>> (sijo-doctest::test #'sqr) | ||
NIL | ||
(values 0 0) | ||
|
||
If you need to test that a function signals a condition for certain inputs | ||
you can use the name of the condition as the expected return value. | ||
|
@@ -159,12 +153,3 @@ Test extracts and tests code snippets embedded in the documentation string | |
Results for SQR (FUNCTION): 1 of 4 failed.| | ||
(values 1 3) | ||
#+end_example | ||
|
||
* Changelog | ||
This fork has some minor differences to the upstream version: | ||
- Tweaked to evaluate expected results to avoid problems with ~fset~ and | ||
readtables; ~#{||}~ cannot be used, and ~(fset:empty-map)~ neither | ||
- Improved working with multiple values | ||
- Added a ~test-package~ function to test all functions in a package | ||
- Print only when tests are failing (useful when testing entire packages) | ||
- ~run-doctests~ doesn't throw on empty docstring (triggered eof error) |
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,6 +1,21 @@ | ||
(defsystem :sijo-doctest | ||
:in-order-to ((test-op (test-op :sijo-doctest/tests))) | ||
:description "Doctests for Common Lisp" | ||
:version "0.2" | ||
:version "0.3" | ||
:author "Johan Lindberg (Pulp Software) <[email protected]>, Simen Endsjø <[email protected]>" | ||
:licence "GPL" | ||
:serial t | ||
:pathname "src/" | ||
:components ((:file "doctest"))) | ||
|
||
(defsystem :sijo-doctest/tests | ||
:depends-on (#:sijo-doctest | ||
#:lisp-unit2) | ||
:perform (test-op (o c) | ||
(eval (read-from-string " | ||
(lisp-unit2:with-summary () | ||
(lisp-unit2:run-tests | ||
:package :sijo-doctest/tests | ||
:name :sijo-doctest))"))) | ||
:pathname "tests/" | ||
:components ((:file "doctest"))) |
Oops, something went wrong.