Skip to content

Commit 94961d5

Browse files
committed
refactor: simplify way to create new tests
Now it's only necessary create a file test-*.lisp in t/ folder. ASDF will take care to declare all the relevant files properly in defsystem, no t/tests.lisp index are more necessary, defpackage of tests was moved to each test file.
1 parent 2434479 commit 94961d5

File tree

7 files changed

+43
-42
lines changed

7 files changed

+43
-42
lines changed

lisp-inference.asd

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
;; -*- mode: lisp -*-
22
;; Manoel Vilela
33

4+
45
;;;; lisp-inference.asd
56

7+
(defpackage :lisp-inference/system
8+
(:use :cl :uiop :asdf))
9+
10+
(in-package :lisp-inference/system)
11+
12+
(defun get-all-test-files ()
13+
(mapcar #'(lambda (p) (list :file (pathname-name p)))
14+
(directory-files (system-relative-pathname :lisp-inference "t/")
15+
"*test*.lisp")))
616

7-
(asdf:defsystem #:lisp-inference
17+
18+
(defsystem #:lisp-inference
819
:description "An Inference Engine using Propositional Calculus"
920
:author "Manoel Vilela <[email protected]>"
1021
:license "BSD"
@@ -23,7 +34,7 @@
2334
(:file "truth-table"
2435
:depends-on ("pratt" "parser" "operators" "equivalences"))))
2536

26-
(asdf:defsystem #:lisp-inference/web
37+
(defsystem #:lisp-inference/web
2738
:description "An web interface for Lisp Inference Truth Table"
2839
:author "Manoel Vilela <[email protected]>"
2940
:license "BSD"
@@ -41,20 +52,15 @@
4152
:pathname "web"
4253
:components ((:file "webapp")))
4354

44-
(asdf:defsystem #:lisp-inference/tests
55+
(defsystem #:lisp-inference/tests
4556
:description "Lisp Inference Tests"
4657
:author "Manoel Vilela <[email protected]>"
4758
:license "BSD"
4859
:version "0.4.0"
4960
:homepage "https://github.com/ryukinix/lisp-inference"
5061
:serial t
51-
:pathname "t"
5262
:depends-on (:lisp-inference :rove)
53-
:components ((:file "tests")
54-
(:file "test-equivalence-rules")
55-
(:file "test-inference-rules")
56-
(:file "test-infix-parsing")
57-
(:file "test-truth-table")
58-
(:file "test-pratt"))
63+
:pathname "t"
64+
:components #.(get-all-test-files)
5965
:perform (test-op (o c)
6066
(symbol-call :rove :run c)))

t/test-equivalence-rules.lisp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
(defpackage #:lisp-inference/tests/test-equivalence-rules
2+
(:use #:cl
3+
#:lisp-inference
4+
#:rove))
5+
16
(in-package #:lisp-inference/tests/test-equivalence-rules)
27

38
(deftest test-equivalence-rules

t/test-inference-rules.lisp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
(defpackage #:lisp-inference/tests/test-inference-rules
2+
(:use #:cl
3+
#:lisp-inference
4+
#:rove))
5+
16
(in-package #:lisp-inference/tests/test-inference-rules)
27

38

t/test-infix-parsing.lisp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
(defpackage #:lisp-inference/tests/test-infix-parsing
2+
(:use #:cl
3+
#:lisp-inference
4+
#:rove))
5+
16
(in-package #:lisp-inference/tests/test-infix-parsing)
27

38
;; deprecated in favor of pratt parser

t/test-pratt.lisp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
(defpackage #:lisp-inference/tests/test-pratt
2+
(:use #:cl
3+
#:lisp-inference
4+
#:rove))
5+
6+
17
(in-package #:lisp-inference/tests/test-pratt)
28

39
(deftest test-pratt

t/test-truth-table.lisp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
(defpackage #:lisp-inference/tests/test-truth-table
2+
(:use #:cl
3+
#:lisp-inference
4+
#:rove))
5+
6+
17
(in-package :lisp-inference/tests/test-truth-table)
28

39
(deftest truth-table-tests

t/tests.lisp

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)