Skip to content

Commit 179b569

Browse files
committed
ci: add gh workflow test
1 parent d4bb370 commit 179b569

3 files changed

Lines changed: 83 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
test:
12+
name: Emacs ${{ matrix.emacs-version }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
emacs-version:
18+
- "30.2"
19+
- "29.4"
20+
- "28.2"
21+
- "27.2"
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: purcell/setup-emacs@master
26+
with:
27+
version: ${{ matrix.emacs-version }}
28+
29+
- name: Install package dependencies
30+
shell: bash
31+
run: |
32+
emacs --batch --no-site-file --no-splash \
33+
--eval "(require 'package)" \
34+
--eval "(setq package-user-dir (expand-file-name \".emacs.d/elpa\" default-directory))" \
35+
--eval "(setq package-archives '((\"gnu\" . \"https://elpa.gnu.org/packages/\") (\"melpa\" . \"https://melpa.org/packages/\")))" \
36+
--eval "(package-initialize)" \
37+
--eval "(package-refresh-contents)" \
38+
--eval "(dolist (pkg '(shut-up multi dash highlight test-simple)) (unless (package-installed-p pkg) (package-install pkg)))"
39+
40+
- name: Run tests
41+
shell: bash
42+
run: |
43+
emacs --batch --no-site-file --no-splash -L . \
44+
--eval "(setq-default indent-tabs-mode nil)" \
45+
--eval "(require 'package)" \
46+
--eval "(setq package-user-dir (expand-file-name \".emacs.d/elpa\" default-directory))" \
47+
--eval "(package-initialize)" \
48+
--load test/csound-mode-tests.el

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The tests depend on the package _test-simple.el_.
9898
Run the tests locally from the command line
9999

100100
```
101-
emacs --batch --no-site-file --no-splash --load test/csound-mode-tests.el
101+
emacs --batch --no-site-file --no-splash -L . --load test/csound-mode-tests.el
102102
```
103103

104104

test/csound-mode-tests.el

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,38 @@ endop")
291291
example-udo-1-expected
292292
(buffer-substring-no-properties (point-min) (point-max))))
293293

294+
(note "Test manual lookup URLs")
295+
296+
(let ((csound-manual-url "file:///tmp/csound-manual"))
297+
(assert-string-equal
298+
"file:///tmp/csound-manual/index.html"
299+
(csound-manual--file-name-concat csound-manual-url "index.html")))
300+
301+
(let ((csound-manual-url "file:///tmp/csound-manual/"))
302+
(assert-string-equal
303+
"file:///tmp/csound-manual/ScoreGenRef.html"
304+
(csound-manual--file-name-concat csound-manual-url "ScoreGenRef.html")))
305+
306+
(let ((csound-manual-url "file:///tmp/csound-manual")
307+
(browse-url-browser-function
308+
(lambda (url &rest _args)
309+
(setq csound-mode-test--browse-url url)))
310+
(csound-mode-test--browse-url nil))
311+
(csound-browse-manual)
312+
(assert-string-equal
313+
"file:///tmp/csound-manual/index.html"
314+
csound-mode-test--browse-url))
315+
316+
(test-with-temp-buffer "f 1 0 1024 10 1"
317+
(let ((csound-manual-url "file:///tmp/csound-manual")
318+
(browse-url-browser-function
319+
(lambda (url &rest _args)
320+
(setq csound-mode-test--browse-url url)))
321+
(csound-mode-test--browse-url nil))
322+
(goto-char 3)
323+
(csound-gen-manual-lookup)
324+
(assert-string-equal
325+
"file:///tmp/csound-manual/GEN01.html"
326+
csound-mode-test--browse-url)))
327+
294328
(end-tests)

0 commit comments

Comments
 (0)