35 lines
1.2 KiB
Common Lisp
35 lines
1.2 KiB
Common Lisp
;;;; cl-scopes/test/test-config
|
|
|
|
;;;; Tests for the scopes/config functionality.
|
|
|
|
(defpackage :scopes/test-config
|
|
(:use :common-lisp)
|
|
(:local-nicknames (:config :scopes/config)
|
|
(:t :scopes/testing))
|
|
(:export #:run)
|
|
(:import-from :scopes/testing #:deftest #:==))
|
|
|
|
(in-package :scopes/test-config)
|
|
|
|
(defvar *config* nil)
|
|
|
|
(defclass test-config (config:base)
|
|
((config:override-keys :initform '(user password))))
|
|
|
|
(defun run ()
|
|
(let ((t:*test-suite* (t:test-suite "config")))
|
|
(setf *config* (make-instance 'test-config))
|
|
(test-make-path)
|
|
(test-env-override)
|
|
(t:show-result)))
|
|
|
|
(t:deftest test-make-path ()
|
|
(format t "~&relative-path: ~s" (config:relative-path "config" "app" "etc"))
|
|
(format t "~%system-path: ~s" (config:system-path :scopes "config" "test"))
|
|
(format t "~%test-path (config): ~s" (config:test-path :scopes "config"))
|
|
(format t "~%test-path (data): ~s" (config:test-path :scopes "test.db" "data"))
|
|
(format t "~%runtime-path: ~s" (config:runtime-path "config" "app" "etc"))
|
|
(format t "~%runtime-path (.env): ~s" (config:runtime-path ".env" "app")))
|
|
|
|
(t:deftest test-env-override ()
|
|
(format t "~%override-keys: ~s" (config:override-keys *config*)))
|