emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/engine-mode 116bd8927d 6/8: Add test stub with Makefile an


From: ELPA Syncer
Subject: [nongnu] elpa/engine-mode 116bd8927d 6/8: Add test stub with Makefile and GitHub action
Date: Mon, 19 Jun 2023 10:00:56 -0400 (EDT)

branch: elpa/engine-mode
commit 116bd8927d553cb09916cde0c48fd8cb0c36ba17
Author: Harry R. Schwartz <hello@harryrschwartz.com>
Commit: Harry R. Schwartz <hello@harryrschwartz.com>

    Add test stub with Makefile and GitHub action
    
    To ensure the actions work, this also backfills some trivial tests for
    `engine--function-name` and `engine--docstring`.
---
 .github/workflows/melpazoid.yml |  2 +-
 .github/workflows/test.yml      | 46 +++++++++++++++++++++++++++++++++++++++++
 Makefile                        |  7 +++++++
 engine-mode-test.el             | 23 +++++++++++++++++++++
 4 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/melpazoid.yml b/.github/workflows/melpazoid.yml
index 090dd20e2b..248d00a1ef 100644
--- a/.github/workflows/melpazoid.yml
+++ b/.github/workflows/melpazoid.yml
@@ -1,7 +1,7 @@
 # melpazoid <https://github.com/riscy/melpazoid> build checks.
 
 name: Melpazoid
-on: [push, pull_request]
+on: pull_request
 
 jobs:
   build:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000000..a32e5ffc34
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,46 @@
+name: Tests
+on: pull_request
+permissions: {}
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        emacs_version:
+          - 24.1
+          - 24.2
+          - 24.3
+          - 24.4
+          - 24.5
+          - 25.1
+          - 25.3
+          - 26.1
+          - 26.2
+          - 26.3
+          - 27.1
+          - 27.2
+          - 28.1
+          - 28.2
+          - snapshot
+        include:
+          - emacs_version: 'snapshot'
+            allow_failure: true
+
+    steps:
+    - uses: actions/checkout@v3
+      with:
+        persist-credentials: false
+
+    - name: Install Emacs
+      uses: purcell/setup-emacs@master
+      with:
+        version: ${{ matrix.emacs_version }}
+
+    - name: Run tests
+      if: matrix.allow_failure != true
+      run: 'make && make test'
+
+    - name: Run tests (allow failure)
+      if: matrix.allow_failure == true
+      run: 'make && make test || true'
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..127e7ed8c2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,7 @@
+.PHONY: test
+test: engine-mode.el engine-mode-test.el
+       emacs --quick --batch \
+       -l ert \
+       -l engine-mode-test.el \
+       --eval "(setq ert-batch-backtrace-right-margin 10000)" \
+       -f ert-run-tests-batch-and-exit
diff --git a/engine-mode-test.el b/engine-mode-test.el
new file mode 100644
index 0000000000..c128bbead2
--- /dev/null
+++ b/engine-mode-test.el
@@ -0,0 +1,23 @@
+;;; engine-mode-test.el --- tests for engine-mode.el
+
+;; -*- lexical-binding: t; -*-
+
+;;; Commentary:
+
+;; Tests for engine-mode.
+
+;;; Code:
+
+(load-file "engine-mode.el")
+
+(ert-deftest engine--function-name ()
+  (should (equal (engine--function-name 'wikipedia)
+                 'engine/search-wikipedia))
+  (should (equal (engine--function-name 'GitHub)
+                 'engine/search-github)))
+
+(ert-deftest engine--docstring ()
+  (should (equal (engine--docstring 'my-engine)
+                 "Search My-Engine for the selected text.\nPrompt for input if 
none is selected.")))
+
+;;; engine-mode-test.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]