我正在尝试使用我在这里找到的指令搭建一个Common Lisp项目:http://turtleware.eu/posts/Tutorial-Working-with-FiveAM.html。我克隆了存储库,并按照文档中的说明进行操作,以便我的.asd文件、package.lisp文件以及tests/package.lisp和tests/main.lisp文件与说明相匹配。我运行了(asdf:test-system 'quasirpg),一切运行正常。
我将这个示例项目复制到我的实际工作文件夹中,并进行了搜索和替换,以将quasirpg的所有实例更改为foo。我运行了(asdf:test-system 'foo),REPL给我一个错误,说找不到包"FOO-TESTS“。
现在,我重新运行(asdf:test-system 'quasirpg),它以前是有效的,并且REPL给我相同的错误,即无法找到包"QUASIRPG-TESTS“。
谁能解释一下这里发生了什么,以及我如何让我的asdf包管理器找到测试包?
Thank you.
;;;; foo.asd
(asdf:defsystem #:foo
:description "Part of the FiveAM tutorial"
:author "Tomek 'uint' Kurcz"
:license "GPLv3"
:serial t
:components ((:file "package")
(:file "foo"))
:in-order-to ((test-op (test-op "foo/tests"))))
(asdf:defsystem #:foo/tests
:depends-on (:foo :fiveam)
:components ((:module "tests"
:serial t
:components ((:file "package")
(:file "main"))))
:perform (test-op (o s)
(uiop:symbol-call :fiveam :run! 'foo-tests:all-tests)))
;;;; tests/package.lisp
(defpackage #:foo-tests
(:use :cl :fiveam)
(:export #:run! #:all-tests))
;;;; tests/main.lisp
(in-package #:foo-tests)
(def-suite all-tests
:description "The master suite of all foo tests.")
;; tests continue below发布于 2020-02-04 04:25:46
我不喜欢像fiveam这样的自动化测试,但你的问题是:perform中对symbol foo-tests:all-tests的引用,它位于一个只有在系统加载之后才会存在的包中。使用find-symbol而不是quote
下面的脚本在我的机器上运行到完成(我是从你帖子中的代码片段开始的):
DIR=~/quicklisp/local-projects/foo
mkdir $DIR
cd $DIR
cat >foo.asd <<EOF
(asdf:defsystem #:foo
:description "Part of the FiveAM tutorial"
:author "Tomek 'uint' Kurcz"
:license "GPLv3"
:serial t
:components ((:file "package")
(:file "foo"))
:in-order-to ((test-op (test-op "foo/tests"))))
(asdf:defsystem #:foo/tests
:depends-on (:foo :fiveam)
:components ((:module "tests"
:serial t
:components ((:file "package")
(:file "main"))))
:perform (test-op (o s)
(uiop:symbol-call :fiveam
:run!
(find-symbol "ALL-TESTS"
"FOO"))))
EOF
touch package.lisp
touch foo.lisp
mkdir tests
cat >tests/package.lisp <<EOF
(defpackage #:foo-tests
(:use :cl :fiveam)
(:export #:run! #:all-tests))
EOF
cat >tests.main.lisp <<EOF
(in-package #:foo-tests)
(def-suite all-tests
:description "The master suite of all foo tests.")
EOF
sbcl --eval '(asdf:load-system "foo")'避免这种符号骗局是一件痛苦的事情,也是为什么我通常不会去接触asdf测试机制,我只做一些可以从repl运行的函数。
https://stackoverflow.com/questions/60031856
复制相似问题