spacemacs/tests/core/core-configuration-layer-ftest.el
syl20bnr 57350a3b48 core: reimplement :packages keyword and update documentation
Old implementation excluded package that were not selected, this
implementation does not excluded them, it simply ignore it in the
layer where they are not selected. This reimplementation comes from
a refactor of the way packages.el files are loaded, instead of loading
these files at the moment of resolving the list of used packages, they
are now loaded when making the layer objects. A neat consequence is that
side effects is better confined and the configuration-layer/get-packages
is now pure (at least a lot more pure than before).
In the `cfgl-layer` class the slot `:user-packages` has been renamed
to `:selected-packages` which defaults to `'all` meaning that all
the packages in `:packages` are selected. `:selected-packages` value
is given by the new function `configuration-layer//select-packages`.
Effectively selected packages are given by a new method for `cfgl-layer`
class called `cfgl-layer-get-packages`.

Tests have been updated to reflect the changes.

Also documentation on configuration layer declaration in the dotfile
section of DOCUMENTATION.org has been greatly improved (I hope) and
reflect the last feature added to the
`dotspacemacs-configuration-layers` list.
2016-06-20 20:48:25 -04:00

34 lines
1.4 KiB
EmacsLisp

;;; core-configuration-layer-ftest.el --- Spacemacs Functional Test File
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(require 'core-configuration-layer)
;; ---------------------------------------------------------------------------
;; configuration-layer//declare-layers
;; ---------------------------------------------------------------------------
(ert-deftest test-declare-layers--bootstrap-layer-always-first ()
(let ((dotspacemacs-distribution 'spacemacs)
(dotspacemacs-configuration-layers '(emacs-lisp
(git :variables foo 'bar))))
(let (configuration-layer--layers)
(configuration-layer//declare-layers)
(should (eq 'spacemacs-bootstrap
(oref (first configuration-layer--layers) :name))))))
(ert-deftest test-declare-layers--distribution-layer-is-second ()
(let ((dotspacemacs-distribution 'spacemacs-base)
(dotspacemacs-configuration-layers '(emacs-lisp
(git :variables foo 'bar))))
(let (configuration-layer--layers)
(configuration-layer//declare-layers)
(should (eq 'spacemacs-base
(oref (second configuration-layer--layers) :name))))))