This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/tests/core/core-configuration-layer-ftest.el
syl20bnr d98be63dfa core: new layer file -> layers.el / Fix regressions of previous commits
The new layer file `layers.el` is used to declared additional layers.
It is like the sibling of packages.el except that for now it does not
take a list (can do this in a futur commit).

The new order for file loading is the following:

layers.el > packages.el > funcs.el > config.el > keybindings.el

Since packages.el relies on some undefined stuff encapsulated
in init functions, it is not meant to be byte compiled. OTOH funcs.el
(where lies most of the computation added by a package config) should
be compilable.

Since we load packages.el very early it is not possible to use
`configuration-layer/package-usedp` in funcs.el.

This commit also fixes the tests.
2016-05-28 21:20:23 -04:00

58 lines
2.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)))
(mocker-mock-default-record-cls 'mocker-stub-record))
(mocker-let
((load (f) ((:output nil))))
(let (configuration-layer--layers)
(configuration-layer//declare-layers)
(should (eq 'spacemacs-bootstrap
(oref (first configuration-layer--layers) :name)))))))
(ert-deftest test-declare-layers--bootstrap-layer-always-first-all ()
(let ((dotspacemacs-distribution 'spacemacs)
(dotspacemacs-configuration-layers 'all)
(mocker-mock-default-record-cls 'mocker-stub-record))
(mocker-let
((load (f) ((:output nil))))
(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))))))
(ert-deftest test-declare-layers--distribution-layer-position-with-all-layers ()
(let ((dotspacemacs-distribution 'spacemacs-base)
(dotspacemacs-configuration-layers 'all)
(mocker-mock-default-record-cls 'mocker-stub-record))
(mocker-let
((load (f) ((:output nil))))
(let (configuration-layer--layers)
(configuration-layer//declare-layers)
(should (eq 'spacemacs-base
(oref (second configuration-layer--layers) :name)))))))