Skip to content

Instantly share code, notes, and snippets.

@lagagain
Created November 28, 2018 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lagagain/1d2e416067f5e32f7b15e7d20e4a72c3 to your computer and use it in GitHub Desktop.
Save lagagain/1d2e416067f5e32f7b15e7d20e4a72c3 to your computer and use it in GitHub Desktop.
Try use FiveAM which is a test framework for Common Lisp.
;;(ql:quickload :fiveam)
(require :fiveam)
(defpackage try-fiveam
(:use :cl)
(:import-from :fiveam test run run! def-suite is))
(in-package try-fiveam)
(test test+
(is (= 2 (+ 1 1)))
(is (not (= 2 (+ 2 2)))))
(run!' test+)
(def-suite a-suite)
(def-suite b-suite :in a-suite)
(def-suite c-suite :in a-suite)
(fiveam:in-suite a-suite)
(test test*
(is (= 1 (* 1 1)))
(is (= 4 (* 2 2))))
(test test-
(is (= 0 (- 1 1))))
(fiveam:in-suite b-suite)
(test test-format
(is (string= "Hello World"
(format nil "Hello World"))))
(run! 'a-suite)
(fiveam:run-all-tests)
@lagagain
Copy link
Author

all output

Running test TEST+ ..
 Did 2 checks.
    Pass: 2 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)


Running test suite A-SUITE
 Running test suite B-SUITE
  Running test TEST-FORMAT .
 Running test suite C-SUITE
 Running test TEST* ..
 Running test TEST- .
 Did 4 checks.
    Pass: 4 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)


Running test suite NIL
 Running test TEST+ ..
Running test suite A-SUITE
 Running test suite B-SUITE
  Running test TEST-FORMAT .
 Running test suite C-SUITE
 Running test TEST* ..
 Running test TEST- .
 Did 6 checks.
    Pass: 6 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

(run! test+)

Running test TEST+ ..
 Did 2 checks.
    Pass: 2 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

(run! 'a-suite)

Running test suite A-SUITE
 Running test suite B-SUITE
  Running test TEST-FORMAT .
 Running test suite C-SUITE
 Running test TEST* ..
 Running test TEST- .
 Did 4 checks.
    Pass: 4 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

(fiveam:run-all-tests)

Running test suite NIL
 Running test TEST+ ..
Running test suite A-SUITE
 Running test suite B-SUITE
  Running test TEST-FORMAT .
 Running test suite C-SUITE
 Running test TEST* ..
 Running test TEST- .
 Did 6 checks.
    Pass: 6 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment