[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/autothemer aa63d8cd5e 02/29: Add github test workflow and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/autothemer aa63d8cd5e 02/29: Add github test workflow and tests. Fail expected due to display type. |
Date: |
Sun, 28 Aug 2022 22:58:36 -0400 (EDT) |
branch: elpa/autothemer
commit aa63d8cd5e005a4bb459e5e5c7cd35ac38410d1a
Author: Jason Milkins <jasonm23@gmail.com>
Commit: Jason Milkins <jasonm23@gmail.com>
Add github test workflow and tests. Fail expected due to display type.
---
.github/workflows/test.yml | 36 ++++++++++++
bin/test | 39 +++++++++++++
tests/theme-example.el | 139 +++++++++++++++++++++++++++++++++------------
3 files changed, 177 insertions(+), 37 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000000..0227237ab0
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,36 @@
+on:
+ push:
+ pull_request:
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ emacs_version:
+ - 24.1
+ - 24.2
+ - 24.3
+ - 24.4
+ - 24.5
+ - 25.1
+ - 25.2
+ - 25.3
+ - 26.1
+ - 26.2
+ - 26.3
+ - 27.1
+ - 27.2
+ - 28.1
+ - snapshot
+ fail-fast: false
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Emacs
+ uses: purcell/setup-emacs@v3.0
+ with:
+ version: ${{ matrix.emacs_version }}
+
+ - name: Test
+ run: |
+ bin/test
diff --git a/bin/test b/bin/test
new file mode 100755
index 0000000000..2f745dbf69
--- /dev/null
+++ b/bin/test
@@ -0,0 +1,39 @@
+#!/bin/sh
+dash="$(dirname "$(find ~/.emacs.d | grep "/dash.el$" | tail -1)")"
+
+EMACS="${EMACS:=emacs}"
+
+cat <<INFO
+════════════════════════════════════════════════════════════════════════════════
+ _ _ _____ _
+ / \ _ _| |_ __|_ _| |__ ___ _ __ ___ ___ _ __
+ / _ \| | | | __/ _ \| | | '_ \ / _ \ '_ ' _ \ / _ \ '__|
+ / ___ \ |_| | || (_) | | | | | | __/ | | | | | __/ |
+/_/ \_\__,_|\__\___/|_| |_| |_|\___|_| |_| |_|\___|_|
+ _____ _
+|_ _|__ ___| |_ ___
+ | |/ _ \/ __| __/ __|
+ | | __/\__ \ |_\__ \\
+ |_|\___||___/\__|___/
+
+────────────────────────────────────────────────────────────────────────────────
+Required packages present:
+Dash: $dash
+════════════════════════════════════════════════════════════════════════════════
+$("$EMACS" --version)
+════════════════════════════════════════════════════════════════════════════════
+INFO
+
+"$EMACS" --batch \
+ -eval "(add-to-list 'load-path \"${dash}\")" \
+ -eval "(add-to-list 'load-path \".\")" \
+ -l ert \
+ -l dash \
+ -l ./autothemer.el \
+ -l ./tests/theme-example.el \
+ --eval "(ert-run-tests-batch-and-exit)"
+exitcode=$?
+
+echo "
+════════════════════════════════════════════════════════════════════════════════"
+exit ${exitcode}
diff --git a/tests/theme-example.el b/tests/theme-example.el
index 5699122967..0462131ba3 100644
--- a/tests/theme-example.el
+++ b/tests/theme-example.el
@@ -2,42 +2,107 @@
;;; Code:
-(load-file "autothemer.el")
-
-(autothemer-deftheme
- theme-example
- "Autothemer example..."
-
- ;; Specify the color classes used by the theme
- ((((class color) (min-colors #xFFFFFF))
- ((class color) (min-colors #xFF)))
-
- ;; Specify the color palette for each of the classes above.
- (example-red "#781210" "#FF0000")
- (example-green "#22881F" "#00D700")
- (example-blue "#212288" "#0000FF")
- (example-purple "#812FFF" "#Af00FF")
- (example-yellow "#EFFE00" "#FFFF00")
- (example-orange "#E06500" "#FF6600")
- (example-cyan "#22DDFF" "#00FFFF"))
-
- ;; specifications for Emacs faces.
- ((button (:underline t :weight 'bold :foreground example-yellow))
- (error (:foreground example-red)))
-
- ;; Forms after the face specifications are evaluated.
- ;; (palette vars can be used, read below for details.)
- (custom-theme-set-variables
- 'theme-example
- `(ansi-color-names-vector
- [,example-red
- ,example-green
- ,example-blue
- ,example-purple
- ,example-yellow
- ,example-orange
- ,example-cyan])))
-
-;; Eval buffer and use as a test sandox.
+(require 'autothemer)
+
+(progn "Test autothemer-deftheme"
+ (autothemer-deftheme theme-example
+ "Autothemer example..."
+
+ ;; Specify the color classes used by the theme
+ ((((class color) (min-colors #xFFFFFF))
+ ((class color) (min-colors #xFF)))
+
+ ;; Specify the color palette for each of the classes above.
+ (example-red "#781210" "#FF0000")
+ (example-green "#22881F" "#00D700")
+ (example-blue "#212288" "#0000FF")
+ (example-purple "#812FFF" "#Af00FF")
+ (example-yellow "#EFFE00" "#FFFF00")
+ (example-orange "#E06500" "#FF6600")
+ (example-cyan "#22DDFF" "#00FFFF"))
+
+ ;; specifications for Emacs faces.
+ ((button (:underline t :weight 'bold :foreground example-yellow))
+ (error (:foreground example-red)))
+
+ ;; Forms after the face specifications are evaluated.
+ ;; (palette vars can be used, read below for details.)
+ (custom-theme-set-variables
+ 'theme-example
+ `(ansi-color-names-vector
+ [,example-red
+ ,example-green
+ ,example-blue
+ ,example-purple
+ ,example-yellow
+ ,example-orange
+ ,example-cyan])))
+
+ (ert-deftest current-theme ()
+ "Test current theme is available."
+ (should (not (null
+ autothemer--current-theme))))
+
+ (ert-deftest theme-has-colors ()
+ "Check theme has colors."
+ (should (eql 7 (length (autothemer--theme-colors
+ autothemer--current-theme)))))
+
+ (ert-deftest theme-has-face-specs ()
+ "Check theme has face specs."
+ (should (eql 2 (length (autothemer--theme-defined-faces
+ autothemer--current-theme)))))
+
+ (ert-deftest color-value ()
+ "Check color value."
+ (should (string= "#781210"
+ (autothemer--color-value
+ (car (autothemer--theme-colors
+ autothemer--current-theme))))))
+
+ (ert-deftest color-name ()
+ "Check color name."
+ (should (string= "example-red"
+ (autothemer--color-name
+ (car (autothemer--theme-colors
+ autothemer--current-theme))))))
+
+ (ert-deftest spec-name ()
+ "Check spec name."
+ (should (equal 'button
+ (car (autothemer--theme-defined-faces
+ autothemer--current-theme)))))
+
+ (ert-deftest theme-has-description ()
+ "Check theme description."
+ (should (string=
+ "Autothemer example..."
+ (autothemer--theme-description
+ autothemer--current-theme))))
+
+ (ert-deftest theme-has-name ()
+ "Check theme name."
+ (should (string=
+ "theme-example"
+ (autothemer--theme-name
+ autothemer--current-theme))))
+
+ (ert-deftest let-palette ()
+ "Check autothemer-let-palette"
+ (should (string=
+ "#781210"
+ (autothemer-let-palette example-red)))))
+
+;;; Example theme in memory:
+'(#s(autothemer--theme
+ (#s(autothemer--color example-red "#781210")
+ #s(autothemer--color example-green "#22881F")
+ #s(autothemer--color example-blue "#212288")
+ #s(autothemer--color example-purple "#812FFF")
+ #s(autothemer--color example-yellow "#EFFE00")
+ #s(autothemer--color example-orange "#E06500")
+ #s(autothemer--color example-cyan "#22DDFF"))
+ (button error)
+ "theme-example" "Autothemer example..."))
;;; theme-example.el ends here
- [nongnu] elpa/autothemer updated (96ca493b9f -> f3a23b4b6d), ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer e0b1c2c0ad 01/29: Add autothemer-let-palette, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer aa63d8cd5e 02/29: Add github test workflow and tests. Fail expected due to display type.,
ELPA Syncer <=
- [nongnu] elpa/autothemer 04a4fad366 03/29: Make sure package dash is available., ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer b1124883ef 04/29: +x bin/setup, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer 0d39a92d90 07/29: Fix naming of README.md, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer a528436677 16/29: 0.2.10, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer b0df7578fc 17/29: Additional parameters for svg generator., ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer 5d7ae3a0be 06/29: Rainbow mode: Colorize names from palette, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer 55db54a2ef 08/29: User parameters added for SVG generator, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer 12dbb2e605 15/29: Merge branch 'master' into develop, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer 67224c4a4c 21/29: Fix test run, ELPA Syncer, 2022/08/28
- [nongnu] elpa/autothemer 726d5b99bb 05/29: Only supporting 26.1 and above, ELPA Syncer, 2022/08/28