Skip to content

Commit ab3dace

Browse files
authored
Merge pull request #52 from ryukinix/refactor-tests-again
refactor: simplify way to create new tests
2 parents 9c5345d + 94961d5 commit ab3dace

14 files changed

+54
-54
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ COPY web web
55
COPY t t
66
COPY src src
77
COPY lisp-inference.asd .
8-
COPY *.lisp .
8+
COPY scripts scripts
99
RUN ros install ./lisp-inference.asd
1010
RUN ros run -s lisp-inference/web -q
1111
EXPOSE 40000

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SBCL_CMD := sbcl --noinform --disable-debugger --load
1+
SBCL_CMD := sbcl --noinform --disable-debugger --load scripts/fix-quicklisp.lisp --load
22
OBJECTS := lisp-inference
33
DOCKER_IMG = lisp-inference
44
VERSION := latest
@@ -8,23 +8,23 @@ all: $(OBJECTS)
88

99

1010
$(OBJECTS): src/*.lisp
11-
$(SBCL_CMD) build.lisp
11+
$(SBCL_CMD) scripts/build.lisp
1212

1313

1414
check:
15-
@$(SBCL_CMD) run-test.lisp
15+
@$(SBCL_CMD) scripts/run-test.lisp
1616

1717

1818
server:
19-
@$(SBCL_CMD) run-server.lisp
19+
@$(SBCL_CMD) scripts/run-server.lisp
2020

2121
docs-worktree:
2222
@if [ ! -d docs ]; then \
2323
git worktree add docs gh-pages -f; \
2424
fi
2525

2626
docs: docs-worktree
27-
@$(SBCL_CMD) run-docs.lisp
27+
@$(SBCL_CMD) scripts/run-docs.lisp
2828

2929
docs-publish:
3030
cd docs/ && git add . && git commit -m "Auto-generated commit from make docs-publish" && git push || true
@@ -39,10 +39,13 @@ docker-run: docker-build
3939
docker run --rm -it --network=host $(DOCKER_IMG)
4040

4141
docker-docs: docker-build docs-worktree
42-
docker run --rm -t -v $(PWD)/docs:/root/.roswell/local-projects/local/lisp-inference/docs --entrypoint=ros $(DOCKER_IMG) run -l run-docs.lisp
42+
docker run --rm -t \
43+
-v $(PWD)/docs:/root/.roswell/local-projects/local/lisp-inference/docs \
44+
--entrypoint=ros $(DOCKER_IMG) \
45+
run -l scripts/fix-quicklisp.lisp -l run-docs.lisp
4346

4447
docker-check: docker-build
45-
docker run --rm -t --entrypoint=ros $(DOCKER_IMG) run -l run-test.lisp
48+
docker run --rm -t --entrypoint=ros $(DOCKER_IMG) run -l scripts/fix-quicklisp.lisp -l scripts/run-test.lisp
4649

4750
docker-publish: docker-build
4851
docker tag $(DOCKER_IMG) $(PUBLIC_IMG)

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)))

build.lisp renamed to scripts/build.lisp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(load "fix-quicklisp")
21
(ql:quickload :prove)
32
(ql:quickload :lisp-inference)
43
(in-package :lisp-inference)
File renamed without changes.

run-docs.lisp renamed to scripts/run-docs.lisp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(load "fix-quicklisp")
21
;; auto generate docs with staple
32
(ql:quickload '(:staple :lisp-inference :lisp-inference/tests :lisp-inference/web) :silent t)
43

run-server.lisp renamed to scripts/run-server.lisp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(load "fix-quicklisp")
21
(ql:quickload :lisp-inference/web)
32
(webapp:start)
43
(loop do

run-test.lisp renamed to scripts/run-test.lisp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(load "fix-quicklisp")
21
(ql:quickload :lisp-inference/tests :silent t)
32

43
(defun rove/utils/reporter::print-source-location-as-file-path (stream file line column)

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

0 commit comments

Comments
 (0)