Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ testdir=$(abs_p tests/$1)
cd ..

echo "Running '$2' for '$1' in '$testdir' folder"
if [ -f $testdir/dotspacemacs.el ]; then
cp $testdir/dotspacemacs.el ~/.spacemacs
fi
cd $testdir && echo "Now in $(pwd)"
make $2
exit $?
2 changes: 1 addition & 1 deletion CONTRIBUTING.org
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ testable layer is enabled in turn.

To add tests for a layer, do the following:
1. Create a subfolder of =tests/= corresponding to the layer you want to test.
2. Write a file called =dotspacemacs.el= in that folder. It should be a minimal
2. Write a file called =init.el= in that folder. It should be a minimal
dotfile that enables the layer in question (and other layers it may depend
on).
3. Write a number of files with tests. Please try to separate unit and
Expand Down
9 changes: 6 additions & 3 deletions core/core-dotspacemacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ state and should only be used for testing."
'boolean
'spacemacs-dotspacemacs-init)

(spacemacs|defc dotspacemacs-verify-spacelpa-archives nil
(spacemacs|defc dotspacemacs-verify-spacelpa-archives t
"If non-nil then verify the signature for downloaded Spacelpa archives."
'boolean
'spacemacs-dotspacemacs-init)
Expand Down Expand Up @@ -250,7 +250,10 @@ whenever you start Emacs."
'boolean
'spacemacs-dotspacemacs-init)

(spacemacs|defc dotspacemacs-configuration-layers '(emacs-lisp)
(spacemacs|defc dotspacemacs-configuration-layers '(emacs-lisp
helm
multiple-cursors
treemacs)
"List of configuration layers to load."
'(repeat (choice symbol (cons symbol sexp)))
'spacemacs-dotspacemacs-layers)
Expand Down Expand Up @@ -731,7 +734,7 @@ visiting README.org files of Spacemacs."
'boolean
'spacemacs-dotspacemacs-init)

(spacemacs|defc dotspacemacs-new-empty-buffer-major-mode nil
(spacemacs|defc dotspacemacs-new-empty-buffer-major-mode 'text-mode
"Set the major mode for a new empty buffer."
'symbol
'spacemacs-dotspacemacs-init)
Expand Down
6 changes: 3 additions & 3 deletions spacemacs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ installation:
@echo "================================================================="
@echo "INSTALLATION OF PACKAGES FOR $(TEST_NAME)"
@echo "================================================================="
@emacs -batch \
SPACEMACSDIR=$(TEST_DIR) emacs -Q -batch \
$(addprefix -l $(EMACS_DIR)/, $(LOAD_FILES))

ifneq ($(strip $(UNIT_TEST_FILES)),)
unit_tests:
@echo "================================================================="
@echo "UNIT TESTS FOR $(TEST_NAME)"
@echo "================================================================="
emacs -batch -l ert \
SPACEMACSDIR=$(TEST_DIR) emacs -Q -batch -l ert \
$(addprefix -l $(EMACS_DIR)/, $(LOAD_FILES)) \
$(addprefix -l $(TEST_DIR)/, $(UNIT_TEST_FILES)) \
-f ert-run-tests-batch-and-exit
Expand All @@ -51,7 +51,7 @@ func_tests:
@echo "================================================================="
@echo "FUNCTIONAL TESTS FOR $(TEST_NAME)"
@echo "================================================================="
@emacs -batch -l ert \
SPACEMACSDIR=$(TEST_DIR) emacs -Q -batch -l ert \
$(addprefix -l $(EMACS_DIR)/, $(LOAD_FILES)) \
$(addprefix -l $(TEST_DIR)/, $(FUNC_TEST_FILES)) \
-f ert-run-tests-batch-and-exit
Expand Down
41 changes: 41 additions & 0 deletions tests/core/core-dotspacemacs-ftest.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
;;; core-dotspacemacs-ftest.el --- Tests for .spacemacs configuration file -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2012-2025 Sylvain Benner & Contributors
;;
;; Author: Aaron L Zeng <me@bcc32.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(require 'cl-lib)
(require 'core-dotspacemacs)

(defun dotspacemacs-vars-and-values ()
(cl-loop for var being the symbols
when (string-prefix-p "dotspacemacs-" (symbol-name var))
when (boundp var)
collect (cons var (symbol-value var))
into vars-and-values
finally return (cl-sort vars-and-values #'string< :key #'car)))

(ert-deftest test-dotspacemacs-template-defaults-match-initial-values ()
(load (concat spacemacs-core-directory "templates/dotspacemacs-template.el"))
(let* ((before (dotspacemacs-vars-and-values))
(_ (progn
(dotspacemacs/layers)
(dotspacemacs/init)))
(after (dotspacemacs-vars-and-values)))
(should (equal before after))))
File renamed without changes.
File renamed without changes.
Loading