branch: externals/system-packages commit c4437bedfd1800ba572f90f6b051d142a22aa46b Author: Alex Branham <bran...@utexas.edu> Commit: Alex Branham <bran...@utexas.edu>
Add some very simple ERT tests --- test/system-packages-test.el | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/system-packages-test.el b/test/system-packages-test.el new file mode 100644 index 0000000..26ac4dd --- /dev/null +++ b/test/system-packages-test.el @@ -0,0 +1,35 @@ +;;; system-packages-test.el --- ERT testing framework for system-packages.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Alex Branham + +;; Author: J. Alexander Branham <alex.bran...@gmail.com> + +(require 'ert) + +(ert-deftest system-packages-get-install () + "Return correct installation command." + (should (string= + (let ((system-packages-use-sudo nil) + (system-packages-package-manager 'guix)) + (system-packages--get-command 'install)) + "guix package -i ")) + (should (string= + (let ((system-packages-use-sudo t) + (system-packages-package-manager 'pacman)) + (system-packages--get-command 'install)) + "sudo pacman -S "))) + +(ert-deftest system-packages-get-install-noconfirm () + "Return correct installation command." + (should (string= + (let ((system-packages-noconfirm t) + (system-packages-use-sudo nil) + (system-packages-package-manager 'guix)) + (system-packages--get-command 'install)) + "guix package -i ")) + (should (string= + (let ((system-packages-noconfirm t) + (system-packages-use-sudo t) + (system-packages-package-manager 'pacman)) + (system-packages--get-command 'install)) + "sudo pacman -S --noconfirm")))