changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/skel/tests.lisp

changeset 698: 96958d3eb5b0
parent: cc89b337384b
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; skel/tests.lisp --- skel tests
2 (defpackage :skel/tests
3  (:use :cl :skel :rt :log :obj :dat/sxp :std/path)
4  (:import-from :uiop :file-exists-p))
5 
6 (in-package :skel/tests)
7 
8 (defsuite :skel)
9 (in-suite :skel)
10 
11 (defun tmp-path (ext) (make-pathname :name (namestring (tmpize-pathname (string (gensym "g")))) :type ext))
12 
13 (deftest header-comments ()
14  "Make sure header comments are generated correctly.
15 
16 This covers variations of make-source-header-comment, make-source-file-header,
17 make-shebang-comment, and make-shebang-file-header."
18  (is (eq (type-of (make-shebang-file-header
19  (make-shebang-comment "/dev/null")))
20  'file-header))
21  (is (eq (type-of (make-source-file-header
22  (make-source-header-comment
23  "foo-test"
24  :timestamp t
25  :description "nothing to see here"
26  :opts '("Definitely-Not_Emacs: T;"))))
27  'file-header)))
28 
29 (deftest skelfile ()
30  "Ensure skelfiles are created and loaded correctly and that they signal
31 the appropriate restarts."
32  (with-tmp-file (f :type "sk")
33  (is (sk-write-file
34  (make-instance 'sk-project :name "nada" :path "test" :vc :hg) :path *tmp* :if-exists :supersede))
35  (is (load-skelfile *tmp*))
36  (is (build-ast (sk-read-file (make-instance 'sk-project) *tmp*)))))
37 
38 (deftest skelrc ()
39  "Ensure skelrc files are created and loaded correctly."
40  (with-tmp-file (f :name "" :type "skelrc")))
41 
42 (deftest makefile ()
43  "Make sure makefiles are making out ok."
44  (with-tmp-file (f :name "" :type "mk")
45  (flet ((mk (&optional path) (make-instance 'makefile :name (gensym)
46  :path (or
47  (when path (merge-pathnames path *tmp*))
48  *tmp*)
49  :description "barfood"))
50  (src (path) (list path))
51  (cmd (&rest body) body)
52  (rule (tr sr) (make-sk-rule (file-namestring tr) sr)))
53  (is (null (sk-write-file (mk) :if-exists :supersede :path (tmp-path "mk"))))
54  (let* ((tr1 (tmp-path "t1"))
55  (tr2 (tmp-path "t2"))
56  (sr (src (tmp-path "s1")))
57  (r1 (rule tr1 sr))
58  (r2 (rule (car sr) (src tr2)))
59  (mk1 (mk "test.mk")))
60  (is (push-mk-rule r1 mk1))
61  (is (push-mk-rule r2 mk1))
62  (is (push-mk-directive
63  (cmd "ifeq ($(DEBUG),1) echo foo
64 endif")
65  mk1))
66  (is (push-mk-var '(a b) mk1))
67  (is (push-mk-var '(b c) mk1))
68  ;; FIXME
69  (is
70  (null
71  (sk-write-file mk1 :if-exists :supersede :path (merge-pathnames (tmp-path "mk") *tmp*))))))))
72 
73 (deftest vm ()
74  "EXPERIMENTAL"
75  (with-skel-vm (vm)
76  (is (sb-lockless::split-ordered-list-p *skel-scope*))
77  (is (sb-vm:arena-p *skel-arena*))
78  (is (skel-vm-p vm))))
79 
80 (deftest asd ()
81  (let ((sk (make-instance 'sk-project :components '((:lisp "test")
82  (:lisp-system "test")))))
83  (is sk)))