From 8f8cd147ce179886c9b56b3f1c9025d5cbc1a511 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Tue, 29 Jun 2021 21:34:14 +0100 Subject: [PATCH] integrate FiveAM into test package def. and main testing file. This builds on the initial set-up in the .asd file. With the .asd file knowing the tests package needs FiveAM, the code here integrates the testing framework in to the .lisp files responsible for housing the tests. The code here is placeholder tests and should be deleted the more I get into the project. They exist just to make sure everything is set-up properly between the various definition/set-up files. --- tests/package.lisp | 4 +++- tests/ritherdon-rest-tests.lisp | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/tests/package.lisp b/tests/package.lisp index 0c3210c..9847d73 100644 --- a/tests/package.lisp +++ b/tests/package.lisp @@ -1,4 +1,6 @@ ;;;; package.lisp (defpackage #:ritherdon-rest-tests - (:use #:cl :fiveam)) + (:use #:cl #:fiveam) + (:export #:run! + #:all-tests)) diff --git a/tests/ritherdon-rest-tests.lisp b/tests/ritherdon-rest-tests.lisp index 462bb4f..6945b34 100644 --- a/tests/ritherdon-rest-tests.lisp +++ b/tests/ritherdon-rest-tests.lisp @@ -2,7 +2,34 @@ (in-package #:ritherdon-rest-tests) -(fiveam:test sum-1 - (fiveam:is (= 3 (+ 1 2)))) +(def-suite all-tests + :description "The master suite of all ritherdon-rest tests.") -(fiveam:run!) +(in-suite all-tests) + +;; These two examples show the 'full' call to the fiveAm test +;; functions. This is just for reference. The 'namespace' is already +;; 'imported' in 'package.lisp'. + +;; (fiveam:test sum-1 +;; (fiveam:is (= 3 (+ 1 2)))) + +;; (fiveam:run!) + +;; How you would normally create the tests -- with fiveAM already +;; set-up in 'package.lisp' and not needing to be explicit about it +;; here. This is similar to 'using static' in C#. + +(defun test-quasi() + (run! 'all-tests)) + +(test dummy-tests + "Just a placeholder." + (is (listp (list 1 2))) + (is (= 5 (+ 2 3))) + (is (< 4 (+ 100 400)))) + +(test dummy-tests-two + "This is another placeholder test. +This is just to make sure everything is set-up properly." + (is (equal 4 4)))