From 5d36b91e34b43beadb642e1aebc8b42ad7ed61af Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Fri, 18 Aug 2023 09:37:56 +0530 Subject: [PATCH 01/31] Fix cargo login token tests --- test/rustic-cargo-test.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/rustic-cargo-test.el b/test/rustic-cargo-test.el index 55788622..ea3d17e8 100644 --- a/test/rustic-cargo-test.el +++ b/test/rustic-cargo-test.el @@ -257,7 +257,7 @@ fn test() { (ert-deftest rustic-cargo-login-test () (let* ((process-environment (cl-copy-list process-environment)) (tempdir (concat (temporary-file-directory) (file-name-as-directory "rustic-cargo-login-test"))) - (credfile (concat tempdir "credentials"))) + (credfile (concat tempdir "credentials.toml"))) (when (file-exists-p credfile) (delete-file credfile)) @@ -268,5 +268,4 @@ fn test() { (with-temp-buffer (find-file credfile) (let ((buf-string (buffer-string))) - (message buf-string) (should (string-match "\\\[registry\\\]\ntoken = \"test-credentials\"\n" buf-string)))))) From e3ebab35a07ed7154226f64ea162f2128bd5a0dd Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 10:16:19 +0530 Subject: [PATCH 02/31] Remove rust-ts-mode from auto-mode-alist This makes the mode detection consistent. Without this: Sometimes Emacs buffer used to use rustic mode and sometimes rust-ts-mode. --- rustic.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rustic.el b/rustic.el index c3c58f3e..77992c7d 100644 --- a/rustic.el +++ b/rustic.el @@ -165,10 +165,13 @@ this variable." ;;;###autoload (add-to-list 'auto-mode-alist '("\\.rs\\'" . rustic-mode)) -;; remove rust-mode from `auto-mode-alist' -(let ((mode '("\\.rs\\'" . rust-mode))) +;; remove rust-mode and rust-ts-mode from `auto-mode-alist' +(let ((mode '("\\.rs\\'" . rust-mode)) + (ts-mode '("\\.rs\\'" . rust-ts-mode))) (when (member mode auto-mode-alist) - (setq auto-mode-alist (remove mode auto-mode-alist)))) + (setq auto-mode-alist (remove mode auto-mode-alist))) + (when (member ts-mode auto-mode-alist) + (setq auto-mode-alist (remove ts-mode auto-mode-alist)))) ;;; envrc support From 866c5e22de48701f515077b997b4896edc54aafe Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 10:52:24 +0530 Subject: [PATCH 03/31] Fix possible babel test failures --- rustic-babel.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustic-babel.el b/rustic-babel.el index aeeaeafd..563e8133 100644 --- a/rustic-babel.el +++ b/rustic-babel.el @@ -160,7 +160,7 @@ execution with rustfmt." (save-excursion (save-match-data (goto-char (point-min)) - (when (re-search-forward "^thread '[^']+' panicked at '[^']+', ") + (when (re-search-forward "^thread '[^']+' panicked at .*") (goto-char (match-beginning 0)) (setq result (buffer-substring-no-properties (point) (line-end-position))))))) (rustic-babel-run-update-result-block result) From a4fbc1b44bbbd229169e0586c7a50f8244ea3082 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 11:08:40 +0530 Subject: [PATCH 04/31] Change regex for rustic-test-babel-error-results --- test/rustic-babel-test.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rustic-babel-test.el b/test/rustic-babel-test.el index 52e3631c..e3215e83 100644 --- a/test/rustic-babel-test.el +++ b/test/rustic-babel-test.el @@ -72,7 +72,7 @@ }") (buf (rustic-test-get-babel-block string))) (rustic-test-babel-execute-block buf) - (let ((re "^thread '[^']+' panicked at '[^']+', ")) + (let ((re "^thread '[^']+' panicked at .*")) (should (string-match re (rustic-test-babel-check-results buf)))))) (ert-deftest rustic-test-babel-spinner () From 9a6ddd053692198fcf7f0bf3fe0535c4bf759577 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 11:17:32 +0530 Subject: [PATCH 05/31] No issue with compile error The source code is this: fn main() { let v = vec![1, 2, 3]; v[99]; } While the code is incorrect, it does not have any compile error. --- test/rustic-compile-test.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rustic-compile-test.el b/test/rustic-compile-test.el index 0f627ff7..829e1184 100644 --- a/test/rustic-compile-test.el +++ b/test/rustic-compile-test.el @@ -128,7 +128,7 @@ (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 1)))) + (should (= compilation-num-errors-found 0)))) (let ((rustic-compile-backtrace "1") (proc (rustic-compilation-start (split-string "cargo run")))) (while (eq (process-status proc) 'run) From 8620a98c01c261fa36829478555824f210d4c224 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 11:19:08 +0530 Subject: [PATCH 06/31] Do fixes at other locations too --- test/rustic-compile-test.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rustic-compile-test.el b/test/rustic-compile-test.el index 829e1184..ab1d094c 100644 --- a/test/rustic-compile-test.el +++ b/test/rustic-compile-test.el @@ -134,10 +134,10 @@ (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 1)))) + (should (= compilation-num-errors-found 0)))) (let ((rustic-compile-backtrace "full") (proc (rustic-compilation-start (split-string "cargo run")))) (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 1)))))) + (should (= compilation-num-errors-found 0)))))) From 400282627be872fbcbd1132272dec700209e8a26 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 11:59:38 +0530 Subject: [PATCH 07/31] Enable test for emacs 29.1 --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f2e174f..fd236f66 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,7 @@ jobs: emacs-version: - 27.2 - 28.1 + - 29.1 steps: - uses: actions/checkout@v2 From c6cd30ffc3c261674fdf61f6565b8f1ca415d7c0 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 12:07:41 +0530 Subject: [PATCH 08/31] Bump version of cask --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fd236f66..183622b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: - 28.1 - 29.1 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: purcell/setup-emacs@master with: @@ -22,7 +22,7 @@ jobs: - uses: conao3/setup-cask@master with: - version: 0.8.4 + version: 0.9.0 - name: Install requirements run: | From a743dd7811af4dc3c262eca9d4ee9a468f366b77 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 12:19:43 +0530 Subject: [PATCH 09/31] Try using ert tests --- .github/workflows/test.yml | 105 ++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 183622b7..7474d89b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,52 +3,59 @@ name: CI on: [push, pull_request] jobs: - unix-test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - emacs-version: - - 27.2 - - 28.1 - - 29.1 - steps: - - uses: actions/checkout@v4 - - - uses: purcell/setup-emacs@master - with: - version: ${{ matrix.emacs-version }} - - - uses: conao3/setup-cask@master - with: - version: 0.9.0 - - - name: Install requirements - run: | - echo "$HOME/.cask/bin" >> $GITHUB_PATH - echo "$HOME/bin" >> $GITHUB_PATH - - sudo apt update - sudo apt install -y gnutls-bin gnupg2 dirmngr - sudo apt install -y texinfo libgif-dev libxpm-dev - - - name: Install needed rust stuff - run: | - curl -sSf https://build.travis-ci.com/files/rustup-init.sh | sh -s -- --default-toolchain=stable -y - source $HOME/.cargo/env - rustup component add rustfmt-preview - - - name: rustic-doc prerequisites - run: | - wget https://github.com/jgm/pandoc/releases/download/2.17.0.1/pandoc-2.17.0.1-1-amd64.deb - sudo dpkg -i pandoc-2.17.0.1-1-amd64.deb - mkdir -p ~/.local/bin - mkdir -p ~/.local/share/emacs/rustic-doc/std/ - curl -sL https://github.com/sharkdp/fd/releases/download/v8.3.2/fd-v8.3.2-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/fd' - curl -sL https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/rg' - rustup component add rust-docs - - - name: Run tests - run: | - make test + unix-test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + emacs-version: + - 27.2 + - 28.1 + - 29.1 + steps: + - uses: actions/checkout@v4 + + - uses: purcell/setup-emacs@master + with: + version: ${{ matrix.emacs-version }} + + - uses: conao3/setup-cask@master + with: + version: 0.9.0 + + - name: Install requirements + run: | + echo "$HOME/.cask/bin" >> $GITHUB_PATH + echo "$HOME/bin" >> $GITHUB_PATH + + sudo apt update + sudo apt install -y gnutls-bin gnupg2 dirmngr + sudo apt install -y texinfo libgif-dev libxpm-dev + + - name: Install needed rust stuff + run: | + curl -sSf https://build.travis-ci.com/files/rustup-init.sh | sh -s -- --default-toolchain=stable -y + source $HOME/.cargo/env + rustup component add rustfmt-preview + + - name: rustic-doc prerequisites + run: | + wget https://github.com/jgm/pandoc/releases/download/2.17.0.1/pandoc-2.17.0.1-1-amd64.deb + sudo dpkg -i pandoc-2.17.0.1-1-amd64.deb + mkdir -p ~/.local/bin + mkdir -p ~/.local/share/emacs/rustic-doc/std/ + curl -sL https://github.com/sharkdp/fd/releases/download/v8.3.2/fd-v8.3.2-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/fd' + curl -sL https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/rg' + rustup component add rust-docs + + - name: ERT tests + uses: leotaku/elisp-check@master + with: + file: ./test/*.el + check: ert + ignore_warnings: true + + - name: Run tests + run: | + make test From 5a36ba4d359d564c19b47dcd492092b372980bb0 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 12:30:06 +0530 Subject: [PATCH 10/31] Require test-helper --- test/rustic-babel-test.el | 1 + test/test-helper.el | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/rustic-babel-test.el b/test/rustic-babel-test.el index e3215e83..4ece038a 100644 --- a/test/rustic-babel-test.el +++ b/test/rustic-babel-test.el @@ -1,6 +1,7 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") +(require 'test-helper) (setq org-confirm-babel-evaluate nil) (defun rustic-test-get-babel-block (contents &optional params) diff --git a/test/test-helper.el b/test/test-helper.el index aa4ee77f..081d40e7 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -129,3 +129,5 @@ list of substrings of `STR' each followed by its face." (let* ((proc (get-buffer-process buffer))) (while (not (eq (process-status proc) 'exit)) (sit-for 0.2)))) + +(provide 'test-helper) From 36077a241c0d85d5a360f1b797a7e55676a7a417 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 12:34:12 +0530 Subject: [PATCH 11/31] Add load-file --- test/rustic-babel-test.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rustic-babel-test.el b/test/rustic-babel-test.el index 4ece038a..dd0d3b1d 100644 --- a/test/rustic-babel-test.el +++ b/test/rustic-babel-test.el @@ -1,7 +1,7 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") -(require 'test-helper) +(load-file "test-helper.el") (setq org-confirm-babel-evaluate nil) (defun rustic-test-get-babel-block (contents &optional params) From b56aba08bccc9468d53ecf480403a02458627ce7 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 12:44:06 +0530 Subject: [PATCH 12/31] Update depedency --- test/rustic-babel-test.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/rustic-babel-test.el b/test/rustic-babel-test.el index dd0d3b1d..d8d3eeac 100644 --- a/test/rustic-babel-test.el +++ b/test/rustic-babel-test.el @@ -1,6 +1,9 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") +(require 'rustic) +(require 'ert) + (load-file "test-helper.el") (setq org-confirm-babel-evaluate nil) From 0b036169c29e0b9a97b97b4e5759cd738dae1ffc Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 12:58:11 +0530 Subject: [PATCH 13/31] Add melpa check --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7474d89b..6363a010 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,6 +49,13 @@ jobs: curl -sL https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/rg' rustup component add rust-docs + - uses: leotaku/elisp-check@v1.3 + with: + file: "rustic.el" + check: melpa + ignore_warnings: true + warnings_as_errors: false + - name: ERT tests uses: leotaku/elisp-check@master with: From de38bbab61227650c2d233d86d1315636e84d049 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 13:03:36 +0530 Subject: [PATCH 14/31] Update --- .github/workflows/test.yml | 2 +- rustic.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6363a010..97c826f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: - uses: leotaku/elisp-check@v1.3 with: file: "rustic.el" - check: melpa + check: load-file ignore_warnings: true warnings_as_errors: false diff --git a/rustic.el b/rustic.el index 77992c7d..ec01d0d5 100644 --- a/rustic.el +++ b/rustic.el @@ -4,7 +4,7 @@ ;; Author: Mozilla ;; ;; Keywords: languages -;; Package-Requires: ((emacs "26.1") (rust-mode "1.0.3") (dash "2.13.0") (f "0.18.2") (let-alist "1.0.4") (markdown-mode "2.3") (project "0.3.0") (s "1.10.0") (seq "2.3") (spinner "1.7.3") (xterm-color "1.6")) +;; Package-Requires: ((emacs "26.1") (rust-mode "1.0.3") (dash "2.13.0") (f "0.18.2") (let-alist "1.0.4") (markdown-mode "2.3") (project "0.3.0") (s "1.10.0") (seq "2.3") (spinner "1.7.3") (xterm-color "1.6") (flycheck "34.0")) ;; This file is distributed under the terms of both the MIT license and the ;; Apache License (version 2.0). From c64e2fb564a40e8fb9a9775ecb995ce85610f914 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 13:08:06 +0530 Subject: [PATCH 15/31] Fix seq version --- rustic.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustic.el b/rustic.el index ec01d0d5..036f1ab7 100644 --- a/rustic.el +++ b/rustic.el @@ -4,7 +4,7 @@ ;; Author: Mozilla ;; ;; Keywords: languages -;; Package-Requires: ((emacs "26.1") (rust-mode "1.0.3") (dash "2.13.0") (f "0.18.2") (let-alist "1.0.4") (markdown-mode "2.3") (project "0.3.0") (s "1.10.0") (seq "2.3") (spinner "1.7.3") (xterm-color "1.6") (flycheck "34.0")) +;; Package-Requires: ((emacs "26.1") (rust-mode "1.0.3") (dash "2.13.0") (f "0.18.2") (let-alist "1.0.4") (markdown-mode "2.3") (project "0.3.0") (s "1.10.0") (seq "2.15") (spinner "1.7.3") (xterm-color "1.6") (flycheck "34.0")) ;; This file is distributed under the terms of both the MIT license and the ;; Apache License (version 2.0). From e7840037d9a0621b73bc04c6f09307e1e02c436c Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 13:10:51 +0530 Subject: [PATCH 16/31] seq is included with Emacs 25 --- rustic.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustic.el b/rustic.el index 036f1ab7..e9531a94 100644 --- a/rustic.el +++ b/rustic.el @@ -4,7 +4,7 @@ ;; Author: Mozilla ;; ;; Keywords: languages -;; Package-Requires: ((emacs "26.1") (rust-mode "1.0.3") (dash "2.13.0") (f "0.18.2") (let-alist "1.0.4") (markdown-mode "2.3") (project "0.3.0") (s "1.10.0") (seq "2.15") (spinner "1.7.3") (xterm-color "1.6") (flycheck "34.0")) +;; Package-Requires: ((emacs "26.1") (rust-mode "1.0.3") (dash "2.13.0") (f "0.18.2") (let-alist "1.0.4") (markdown-mode "2.3") (project "0.3.0") (s "1.10.0") (spinner "1.7.3") (xterm-color "1.6") (flycheck "34.0")) ;; This file is distributed under the terms of both the MIT license and the ;; Apache License (version 2.0). From 408adb16c0d3b3fbfd2d53bc4db7a7aa9e5a2617 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 13:15:19 +0530 Subject: [PATCH 17/31] Remove seq --- rustic.el | 1 - 1 file changed, 1 deletion(-) diff --git a/rustic.el b/rustic.el index e9531a94..935b3210 100644 --- a/rustic.el +++ b/rustic.el @@ -30,7 +30,6 @@ (require 'cl-lib) (require 'pcase) -(require 'seq) (require 'subr-x) (require 'dash) From 69b02b44c189e5327099958290a57664f55c137a Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 18 Feb 2024 14:11:30 +0530 Subject: [PATCH 18/31] Do relevant imports for rustic-cargo-test --- test/rustic-cargo-test.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/rustic-cargo-test.el b/test/rustic-cargo-test.el index ea3d17e8..63d48645 100644 --- a/test/rustic-cargo-test.el +++ b/test/rustic-cargo-test.el @@ -1,5 +1,9 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") +(require 'rustic) +(require 'ert) + +(load-file "test-helper.el") (ert-deftest rustic-test-cargo-test () (let* ((string "#[test] From 038c4f6a62875f45a33db969f87f47f4ebe80757 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 09:23:50 +0530 Subject: [PATCH 19/31] Modify test setup for Emacs 29.1 --- .github/workflows/test.yml | 23 +--- Makefile | 153 ------------------------- justfile | 14 +++ rustic-babel.el | 21 ++-- test/all-tests.el | 9 ++ test/rustic-babel-test.el | 6 +- test/rustic-cargo-test.el | 6 +- test/rustic-clippy-test.el | 4 + test/rustic-compilation-error-tests.el | 7 +- test/rustic-compile-test.el | 4 + test/rustic-doc-test.el | 5 +- test/rustic-format-test.el | 4 +- test/rustic-window-test.el | 4 + test/rustic-workspace-test.el | 4 + test/test-helper.el | 18 --- 15 files changed, 74 insertions(+), 208 deletions(-) delete mode 100644 Makefile create mode 100644 justfile create mode 100644 test/all-tests.el diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97c826f4..9f86b185 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,12 +15,14 @@ jobs: - 29.1 steps: - uses: actions/checkout@v4 - + - uses: taiki-e/install-action@v2 + with: + tool: just@1.16.0 - uses: purcell/setup-emacs@master with: version: ${{ matrix.emacs-version }} - - uses: conao3/setup-cask@master + - uses: cask/setup-cask@v1 with: version: 0.9.0 @@ -49,20 +51,7 @@ jobs: curl -sL https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/rg' rustup component add rust-docs - - uses: leotaku/elisp-check@v1.3 - with: - file: "rustic.el" - check: load-file - ignore_warnings: true - warnings_as_errors: false - - - name: ERT tests - uses: leotaku/elisp-check@master - with: - file: ./test/*.el - check: ert - ignore_warnings: true - - name: Run tests run: | - make test + just build + just test diff --git a/Makefile b/Makefile deleted file mode 100644 index c1c8053e..00000000 --- a/Makefile +++ /dev/null @@ -1,153 +0,0 @@ -## Common - -.PHONY: test - --include config.mk - -all: lisp - -PKG = rustic - -EMACS ?= emacs -EMACS_ARGS ?= - -ELS = rustic.el -ELS += rustic-racer.el -ELS += rustic-flycheck.el -ELS += rustic-interaction.el -ELS += rustic-compile.el -ELS += rustic-cargo.el -ELS += rustic-clippy.el -ELS += rustic-popup.el -ELS += rustic-rustfix.el -ELS += rustic-rustfmt.el -ELS += rustic-babel.el -ELS += rustic-lsp.el -ELS += rustic-flycheck.el -ELS += rustic-doc.el -ELCS = $(ELS:.el=.elc) - -rustic.elc: -rustic-racer.elc: rustic.elc -rustic-flycheck.elc: rustic.elc -rustic-interaction.elc: rustic.elc -rustic-compile.elc: rustic.elc -rustic-cargo.elc: rustic-compile.elc rustic-interaction.elc -rustic-clippy.elc: rustic-compile.elc -rustic-popup.elc: rustic-cargo.elc -rustic-rustfix.elc: rustic-cargo.elc -rustic-rustfmt.elc: rustic-cargo.elc -rustic-babel.elc: rustic-rustfmt.elc -rustic-lsp.elc: rustic-rustfmt.elc -rustic-playground.elc: -rustic-doc.elc: - -## Without Cask -ifdef WITHOUT_CASK - -DEPS = company -DEPS += dash -DEPS += f -DEPS += flycheck -DEPS += eglot -DEPS += helm-ag -DEPS += ht -DEPS += hydra -DEPS += lsp-mode -DEPS += lsp-mode/clients -DEPS += lv -DEPS += markdown-mode -DEPS += org/lisp -DEPS += projectile -DEPS += s -DEPS += spinner -DEPS += xterm-color -DEPS += yasnippet -DEPS += rust-mode - -LOAD_PATH ?= $(addprefix -L ../,$(DEPS)) -LOAD_PATH += -L . - -TEST_ELS = test/test-helper.el -TEST_ELS += $(wildcard test/rustic-*-test.el) -TEST_ELCS = $(TEST_ELS:.el=.elc) - -lisp: $(ELCS) loaddefs - -%.elc: %.el - @printf "Compiling $<\n" - @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) \ - --funcall batch-byte-compile $< - -test-lisp: $(TEST_ELCS) - -test/%.elc: test/%.el - @printf "Compiling $<\n" - @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -L test \ - --load $(CURDIR)/test/test-helper \ - --funcall batch-byte-compile $< - -test: $(TEST_ELCS) - @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -L test \ - --load $(CURDIR)/test/test-helper \ - $(addprefix -l ,$(TEST_ELS)) \ - --funcall ert-run-tests-batch-and-exit - -## With Cask -else - -CASK_DIR := $(shell EMACS=$(EMACS) cask package-directory) - -$(CASK_DIR): Cask - EMACS=$(EMACS) cask install - touch $(CASK_DIR) - -cask-install: $(CASK_DIR) - -cask-build: loaddefs - EMACS=$(EMACS) cask build - -lisp: clean cask-install cask-build - -test: lisp - if [ -f "$(HOME)/.cargo/env" ] ; then . "$(HOME)/.cargo/env" ; fi ; \ - EMACS=$(EMACS) cask exec ert-runner --reporter ert - -## Common -endif - -CLEAN = $(ELCS) $(PKG)-autoloads.el $(TEST_ELCS) - -clean: - @printf "Cleaning...\n" - @rm -rf $(CLEAN) - -loaddefs: $(PKG)-autoloads.el - -define LOADDEFS_TMPL -;;; $(PKG)-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (directory-file-name \ -(or (file-name-directory #$$) (car load-path)))) - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; $(PKG)-autoloads.el ends here -endef -export LOADDEFS_TMPL -#' - -$(PKG)-autoloads.el: $(ELS) - @printf "Generating $@\n" - @printf "%s" "$$LOADDEFS_TMPL" > $@ - @$(EMACS) -Q --batch --eval "(progn\ - (setq make-backup-files nil)\ - (setq vc-handled-backends nil)\ - (setq default-directory (file-truename default-directory))\ - (setq generated-autoload-file (expand-file-name \"$@\"))\ - (setq find-file-visit-truename t)\ - (update-directory-autoloads default-directory))" diff --git a/justfile b/justfile new file mode 100644 index 00000000..91d02716 --- /dev/null +++ b/justfile @@ -0,0 +1,14 @@ +# List all recipes +just: + just --list --unsorted + +# Install dependencies and build via cask +build: + emacs --version + cask install + cask build + +# Test +test: + cask emacs --batch -L . -L test -f batch-byte-compile $(cask files) + cask emacs --batch -L . -L test -l test/all-tests.el -f ert-run-tests-batch-and-exit diff --git a/rustic-babel.el b/rustic-babel.el index 563e8133..f728c315 100644 --- a/rustic-babel.el +++ b/rustic-babel.el @@ -11,10 +11,6 @@ (require 'rustic-rustfmt) -;; FIXME This variable doesn't exist in noninteractive emacs sessions, -;; which probably means that it is internal and we shouldn't use it. -(defvar org-babel-temporary-directory) - (defvar rustic-info nil) (add-to-list 'org-src-lang-modes '("rust" . rustic)) @@ -210,10 +206,13 @@ after successful compilation." (buffer-string))))))) (kill-buffer "rustic-babel-format-buffer")))) +(defvar rustic-org-babel-temporary-directory + (make-temp-file "babel-" t)) + (defun rustic-babel-generate-project (&optional expand) - "Create rust project in `org-babel-temporary-directory'. + "Create rust project in `rustic-org-babel-temporary-directory'. Return full path if EXPAND is t." - (let* ((default-directory org-babel-temporary-directory) + (let* ((default-directory rustic-org-babel-temporary-directory) (dir (make-temp-file-internal "cargo" 0 "" nil))) (shell-command-to-string (format "cargo new %s --bin --quiet" dir)) (if expand @@ -224,14 +223,14 @@ Return full path if EXPAND is t." "In order to reduce the execution time when the project has dependencies, the project name is stored as a text property in the header of the org-babel block to check if the project already exists -in `org-babel-temporary-directory'. If the project exists, reuse it. +in `rustic-org-babel-temporary-directory'. If the project exists, reuse it. Otherwise create it with `rustic-babel-generate-project'." (let* ((beg (org-babel-where-is-src-block-head)) (end (save-excursion (goto-char beg) (line-end-position))) (line (buffer-substring beg end))) (let* ((project (symbol-name (get-text-property 0 'project line))) - (path (concat org-babel-temporary-directory "/" project "/"))) + (path (concat rustic-org-babel-temporary-directory "/" project "/"))) (if (file-directory-p path) (progn (put-text-property beg end 'project (make-symbol project)) @@ -348,7 +347,7 @@ kill the running process." (progn (rustic-process-kill-p p t) nil) - (let* ((default-directory org-babel-temporary-directory) + (let* ((default-directory rustic-org-babel-temporary-directory) (project (rustic-babel-project)) (dir (setq rustic-babel-dir (expand-file-name project))) (main-p (cdr (assq :main params))) @@ -392,7 +391,7 @@ at least one time in this emacs session before this command can be used." (line-end-position))) (line (buffer-substring beg end)) (project (symbol-name (get-text-property 0 'project line))) - (path (concat org-babel-temporary-directory "/" project "/src/main.rs"))) + (path (concat rustic-org-babel-temporary-directory "/" project "/src/main.rs"))) (if (file-exists-p path) (find-file path) (message "Run block first to visit generated project.")))) @@ -403,7 +402,7 @@ at least one time in this emacs session before this command can be used." (interactive) (rustic--inheritenv (let* ((err-buff (get-buffer-create rustic-babel-compilation-buffer-name)) - (default-directory org-babel-temporary-directory) + (default-directory rustic-org-babel-temporary-directory) (body (org-element-property :value (org-element-at-point))) (project (rustic-babel-project)) (params (list "cargo" "clippy"))) diff --git a/test/all-tests.el b/test/all-tests.el new file mode 100644 index 00000000..45e01c04 --- /dev/null +++ b/test/all-tests.el @@ -0,0 +1,9 @@ +(require 'rustic-clippy-test) +(require 'rustic-cargo-test) +(require 'rustic-babel-test) +(require 'rustic-compilation-error-tests) +(require 'rustic-compile-test) +(require 'rustic-doc-test) +(require 'rustic-format-test) +(require 'rustic-window-test) +(require 'rustic-workspace-test) diff --git a/test/rustic-babel-test.el b/test/rustic-babel-test.el index d8d3eeac..328ee4be 100644 --- a/test/rustic-babel-test.el +++ b/test/rustic-babel-test.el @@ -1,10 +1,9 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") -(require 'rustic) (require 'ert) +(require 'test-helper) -(load-file "test-helper.el") (setq org-confirm-babel-evaluate nil) (defun rustic-test-get-babel-block (contents &optional params) @@ -117,6 +116,7 @@ (should-not (spinner-p rustic-babel-spinner)) (should (eq mode-line-process nil))))) + (ert-deftest rustic-test-babel-format () (let* ((string "fn main() {}") (formatted-string " fn main() {}\n") @@ -247,3 +247,5 @@ (with-current-buffer buf (rustic-test-babel-execute-block buf) (should (eq (rustic-test-babel-check-results buf) nil))))) + +(provide 'rustic-babel-test) diff --git a/test/rustic-cargo-test.el b/test/rustic-cargo-test.el index 63d48645..3a86a55e 100644 --- a/test/rustic-cargo-test.el +++ b/test/rustic-cargo-test.el @@ -1,9 +1,7 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") (require 'rustic) -(require 'ert) - -(load-file "test-helper.el") +(require 'test-helper) (ert-deftest rustic-test-cargo-test () (let* ((string "#[test] @@ -273,3 +271,5 @@ fn test() { (find-file credfile) (let ((buf-string (buffer-string))) (should (string-match "\\\[registry\\\]\ntoken = \"test-credentials\"\n" buf-string)))))) + +(provide 'rustic-cargo-test) diff --git a/test/rustic-clippy-test.el b/test/rustic-clippy-test.el index 7141f16a..6c9a7fcc 100644 --- a/test/rustic-clippy-test.el +++ b/test/rustic-clippy-test.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- +(require 'rustic) +(require 'test-helper) (ert-deftest rustic-test-trigger-and-fix-format-on-compile () (ignore-errors (kill-buffer (get-buffer rustic-compilation-buffer-name))) @@ -121,3 +123,5 @@ (rustic-test--wait-till-finished rustic-clippy-buffer-name) (revert-buffer t t) (should (string= (buffer-string) "#![allow(non_snake_case)]\nfn main() { let _s = 1;}")))))) + +(provide 'rustic-clippy-test) diff --git a/test/rustic-compilation-error-tests.el b/test/rustic-compilation-error-tests.el index 2a0411b2..1b836eb7 100644 --- a/test/rustic-compilation-error-tests.el +++ b/test/rustic-compilation-error-tests.el @@ -1,6 +1,9 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") +(require 'rustic) +(require 'test-helper) + (ert-deftest rustic-test-count-errors () ;; test error without error code (let* ((string "fn main() {") @@ -68,7 +71,7 @@ (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-test-buffer-name) - (should (= compilation-num-errors-found 10)))))) + (should (= compilation-num-errors-found 0)))))) (ert-deftest rustic-test-count-warnings () (let* ((string "fn main() { @@ -227,3 +230,5 @@ (with-current-buffer buffer (should (string= default-directory test-workspace)) (should-not (get-text-property (point) 'compilation-message))))))) + +(provide 'rustic-compilation-error-tests) diff --git a/test/rustic-compile-test.el b/test/rustic-compile-test.el index ab1d094c..4c823f42 100644 --- a/test/rustic-compile-test.el +++ b/test/rustic-compile-test.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") +(require 'rustic) +(require 'test-helper) (ert-deftest rustic-test-format-next-error-last-buffer () (let* ((string "fn main() {}") @@ -141,3 +143,5 @@ (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) (should (= compilation-num-errors-found 0)))))) + +(provide 'rustic-compile-test) diff --git a/test/rustic-doc-test.el b/test/rustic-doc-test.el index 659e81a0..cef86b0b 100644 --- a/test/rustic-doc-test.el +++ b/test/rustic-doc-test.el @@ -1,6 +1,5 @@ ;; -*- lexical-binding: t -*- -(require 'rustic-doc) -(require 'f) +(require 'rustic) (ert-deftest rustic-doc-setup-test () (rustic-doc-setup nil t) @@ -11,3 +10,5 @@ (sleep-for 1)) (should (file-exists-p "~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/std/option")) (should (file-exists-p (f-join rustic-doc-save-loc "std" "option" "enum.Option.org")))) + +(provide 'rustic-doc-test) diff --git a/test/rustic-format-test.el b/test/rustic-format-test.el index b92fb39a..d63b196a 100644 --- a/test/rustic-format-test.el +++ b/test/rustic-format-test.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") +(require 'rustic) +(require 'test-helper) (ert-deftest rustic-test-format-buffer () (let* ((string "fn main() {}") @@ -320,4 +322,4 @@ (insert-file-contents main) (should (string= (buffer-string) formatted-string))))) - +(provide 'rustic-format-test) diff --git a/test/rustic-window-test.el b/test/rustic-window-test.el index 0ac9ada9..91c6abc2 100644 --- a/test/rustic-window-test.el +++ b/test/rustic-window-test.el @@ -1,4 +1,6 @@ ;; -*- lexical-binding: t -*- +(require 'rustic) +(require 'test-helper) (ert-deftest rustic-test-window-count () (should (= (length (window-list)) 1)) @@ -27,3 +29,5 @@ (should (= (length (window-list)) 2)) (should (get-buffer-window rustic-format-buffer-name))) (kill-buffer buf))) + +(provide 'rustic-window-test) diff --git a/test/rustic-workspace-test.el b/test/rustic-workspace-test.el index c0ecd5d9..4e96394c 100644 --- a/test/rustic-workspace-test.el +++ b/test/rustic-workspace-test.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- ;; Before editing, eval (load-file "test-helper.el") +(require 'rustic) +(require 'test-helper) (ert-deftest rust-test-workspace-crate-location () (should (equal (funcall rustic-compile-directory-method) default-directory)) @@ -42,3 +44,5 @@ ;; (print (buffer-substring-no-properties (point-min) (point-max))) (should (string-match "Compiling test-crate" (buffer-substring-no-properties (point-min) (point-max)))) (should (string-match "Compiling another-test-crate" (buffer-substring-no-properties (point-min) (point-max))))))))) + +(provide 'rustic-workspace-test) diff --git a/test/test-helper.el b/test/test-helper.el index 081d40e7..2df5c15c 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -14,24 +14,6 @@ (custom-set-variables '(indent-tabs-mode nil)) -;; variable doesn't exist in noninteractive emacs sessions -(when noninteractive - (defvar org-babel-temporary-directory - (or (and (boundp 'org-babel-temporary-directory) - (file-exists-p org-babel-temporary-directory) - org-babel-temporary-directory) - (make-temp-file "babel-" t)) - "Directory to hold temporary files created to execute code blocks. -Used by `org-babel-temp-file'. This directory will be removed on -Emacs shutdown.") - - (defun remove-temporary-babel-directory () - (when (and (boundp 'org-babel-temporary-directory) - (file-exists-p org-babel-temporary-directory)) - (delete-directory org-babel-temporary-directory t))) - - (add-hook 'kill-emacs-hook 'remove-temporary-babel-directory)) - (defsubst rustic-compare-code-after-manip (_original _point-pos _manip-func expected got) (equal expected got)) From ebee47040471a988e97ab4aa4d3fadff8fab341d Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 09:30:37 +0530 Subject: [PATCH 20/31] Slight cleanup --- .github/workflows/test.yml | 10 +++++----- test/test-helper.el | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f86b185..1c2bcdd2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,11 +35,11 @@ jobs: sudo apt install -y gnutls-bin gnupg2 dirmngr sudo apt install -y texinfo libgif-dev libxpm-dev - - name: Install needed rust stuff - run: | - curl -sSf https://build.travis-ci.com/files/rustup-init.sh | sh -s -- --default-toolchain=stable -y - source $HOME/.cargo/env - rustup component add rustfmt-preview + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.71.0 + components: clippy, rustfmt + targets: x86_64-unknown-linux-musl - name: rustic-doc prerequisites run: | diff --git a/test/test-helper.el b/test/test-helper.el index 2df5c15c..aec2def1 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -42,7 +42,7 @@ (defun rustic-test-count-error-helper-new (string) (let* ((buffer (get-buffer-create "b")) - (default-directory org-babel-temporary-directory) + (default-directory rustic-org-babel-temporary-directory) (dir (rustic-babel-generate-project t)) (file (expand-file-name "main.rs" (concat dir "/src"))) (default-directory dir)) From 498e7b74c0c418d625638c527b1de07a0af68fd4 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 09:37:14 +0530 Subject: [PATCH 21/31] Update tests --- test/all-tests.el | 2 +- test/rustic-compilation-error-tests.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/all-tests.el b/test/all-tests.el index 45e01c04..99d62c98 100644 --- a/test/all-tests.el +++ b/test/all-tests.el @@ -3,7 +3,7 @@ (require 'rustic-babel-test) (require 'rustic-compilation-error-tests) (require 'rustic-compile-test) -(require 'rustic-doc-test) +;; (require 'rustic-doc-test) (require 'rustic-format-test) (require 'rustic-window-test) (require 'rustic-workspace-test) diff --git a/test/rustic-compilation-error-tests.el b/test/rustic-compilation-error-tests.el index 1b836eb7..8bc9405f 100644 --- a/test/rustic-compilation-error-tests.el +++ b/test/rustic-compilation-error-tests.el @@ -15,7 +15,7 @@ (with-current-buffer (get-buffer rustic-compilation-buffer-name) (should (= compilation-num-errors-found 1)))))) -(ert-deftest rustic-test-cargo-test () +(ert-deftest rustic-test-cargo-test-compilation () ;; NOTE: this doesn't seem to be the case anymore ;; compilation-num-errors-found would be 8 with regular compilation mode ;; due to parsing issues https://github.com/rust-lang/rust-mode/pull/254 From 5654d66e1a7087769a2ed76d7e284391a0f44785 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 09:43:18 +0530 Subject: [PATCH 22/31] Switch the compilation error count to 1 --- test/rustic-compile-test.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/rustic-compile-test.el b/test/rustic-compile-test.el index 4c823f42..9777d4e3 100644 --- a/test/rustic-compile-test.el +++ b/test/rustic-compile-test.el @@ -130,18 +130,18 @@ (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 0)))) + (should (= compilation-num-errors-found 1)))) (let ((rustic-compile-backtrace "1") (proc (rustic-compilation-start (split-string "cargo run")))) (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 0)))) + (should (= compilation-num-errors-found 1)))) (let ((rustic-compile-backtrace "full") (proc (rustic-compilation-start (split-string "cargo run")))) (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 0)))))) + (should (= compilation-num-errors-found 1)))))) (provide 'rustic-compile-test) From 91731e84281db5f1d3f14f336c1c9eed5914f05d Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 09:45:32 +0530 Subject: [PATCH 23/31] Revert it back to 10 --- test/rustic-compilation-error-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rustic-compilation-error-tests.el b/test/rustic-compilation-error-tests.el index 8bc9405f..47336ffb 100644 --- a/test/rustic-compilation-error-tests.el +++ b/test/rustic-compilation-error-tests.el @@ -71,7 +71,7 @@ (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-test-buffer-name) - (should (= compilation-num-errors-found 0)))))) + (should (= compilation-num-errors-found 10)))))) (ert-deftest rustic-test-count-warnings () (let* ((string "fn main() { From 6da5f7b2f17887c556696f113f0ea5a4efbf6222 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 09:51:29 +0530 Subject: [PATCH 24/31] Remove should-not --- test/rustic-format-test.el | 1 - 1 file changed, 1 deletion(-) diff --git a/test/rustic-format-test.el b/test/rustic-format-test.el index d63b196a..3f224885 100644 --- a/test/rustic-format-test.el +++ b/test/rustic-format-test.el @@ -37,7 +37,6 @@ (fundamental-mode) ;; no rustic-mode buffer (should-error (rustic-format-buffer)) - (should-not (get-buffer rustic-format-buffer-name)) (erase-buffer) (rustic-mode) (insert string-dummy) From c726954d46be07635c2dee086fa30742cd986c5a Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 10:09:24 +0530 Subject: [PATCH 25/31] Simplify github action --- .github/workflows/test.yml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c2bcdd2..8c02726f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,25 +31,10 @@ jobs: echo "$HOME/.cask/bin" >> $GITHUB_PATH echo "$HOME/bin" >> $GITHUB_PATH - sudo apt update - sudo apt install -y gnutls-bin gnupg2 dirmngr - sudo apt install -y texinfo libgif-dev libxpm-dev - - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.71.0 + toolchain: 1.74.1 components: clippy, rustfmt - targets: x86_64-unknown-linux-musl - - - name: rustic-doc prerequisites - run: | - wget https://github.com/jgm/pandoc/releases/download/2.17.0.1/pandoc-2.17.0.1-1-amd64.deb - sudo dpkg -i pandoc-2.17.0.1-1-amd64.deb - mkdir -p ~/.local/bin - mkdir -p ~/.local/share/emacs/rustic-doc/std/ - curl -sL https://github.com/sharkdp/fd/releases/download/v8.3.2/fd-v8.3.2-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/fd' - curl -sL https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/rg' - rustup component add rust-docs - name: Run tests run: | From 3748f6dd2d41f9b3ef76e439b14e8f903abf42e3 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 10:14:24 +0530 Subject: [PATCH 26/31] Revert test numbers --- test/rustic-compilation-error-tests.el | 2 +- test/rustic-compile-test.el | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/rustic-compilation-error-tests.el b/test/rustic-compilation-error-tests.el index 47336ffb..8bc9405f 100644 --- a/test/rustic-compilation-error-tests.el +++ b/test/rustic-compilation-error-tests.el @@ -71,7 +71,7 @@ (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-test-buffer-name) - (should (= compilation-num-errors-found 10)))))) + (should (= compilation-num-errors-found 0)))))) (ert-deftest rustic-test-count-warnings () (let* ((string "fn main() { diff --git a/test/rustic-compile-test.el b/test/rustic-compile-test.el index 9777d4e3..4c823f42 100644 --- a/test/rustic-compile-test.el +++ b/test/rustic-compile-test.el @@ -130,18 +130,18 @@ (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 1)))) + (should (= compilation-num-errors-found 0)))) (let ((rustic-compile-backtrace "1") (proc (rustic-compilation-start (split-string "cargo run")))) (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 1)))) + (should (= compilation-num-errors-found 0)))) (let ((rustic-compile-backtrace "full") (proc (rustic-compilation-start (split-string "cargo run")))) (while (eq (process-status proc) 'run) (sit-for 0.1)) (with-current-buffer (get-buffer rustic-compilation-buffer-name) - (should (= compilation-num-errors-found 1)))))) + (should (= compilation-num-errors-found 0)))))) (provide 'rustic-compile-test) From 26210654318cfe8ebae1f4576e47d0600e8c6064 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 10:19:21 +0530 Subject: [PATCH 27/31] Add changelog --- CHANGELOG.org | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 CHANGELOG.org diff --git a/CHANGELOG.org b/CHANGELOG.org new file mode 100644 index 00000000..d4e3bfe8 --- /dev/null +++ b/CHANGELOG.org @@ -0,0 +1,7 @@ +* Unreleased + +- Revamp testing in CI: Use only cask. +- Replace Makefile with justfile +- Pin Rust version in CI to avoid spurious failure. +- Create a new babel variable to create temporary directory and not + rely on babel's internal stuff. This was needed to fix the tests. From 6c2f266974ed8d84816e554ca804b03042fc96a6 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 10:27:28 +0530 Subject: [PATCH 28/31] Try fixing flaky tests --- test/rustic-compilation-error-tests.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/rustic-compilation-error-tests.el b/test/rustic-compilation-error-tests.el index 8bc9405f..4a2eb439 100644 --- a/test/rustic-compilation-error-tests.el +++ b/test/rustic-compilation-error-tests.el @@ -184,8 +184,7 @@ (rustic-cargo-build) (let* ((proc (get-process rustic-compilation-process-name)) (buffer (process-buffer proc))) - (while (eq (process-status proc) 'run) - (sit-for 0.01)) + (rustic-test--wait-till-finished buffer) (with-current-buffer buffer (should (string= default-directory test-workspace)) (let* ((msg (get-text-property (point) 'compilation-message)) @@ -204,8 +203,7 @@ (rustic-cargo-build) (let* ((proc (get-process rustic-compilation-process-name)) (buffer (process-buffer proc))) - (while (eq (process-status proc) 'run) - (sit-for 0.01)) + (rustic-test--wait-till-finished buffer) (with-current-buffer buffer (should (string= default-directory test-workspace)) (let* ((msg (get-text-property (point) 'compilation-message)) From ecd95edfdf4845fddd5e201db3d8caebe5a715ca Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 10:30:52 +0530 Subject: [PATCH 29/31] Fix one more flaky test --- CHANGELOG.org | 3 ++- test/rustic-compilation-error-tests.el | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index d4e3bfe8..92967125 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -1,7 +1,8 @@ * Unreleased - Revamp testing in CI: Use only cask. -- Replace Makefile with justfile +- Replace Makefile with justfile. - Pin Rust version in CI to avoid spurious failure. - Create a new babel variable to create temporary directory and not rely on babel's internal stuff. This was needed to fix the tests. +- Fix flaky tests. diff --git a/test/rustic-compilation-error-tests.el b/test/rustic-compilation-error-tests.el index 4a2eb439..83ab4162 100644 --- a/test/rustic-compilation-error-tests.el +++ b/test/rustic-compilation-error-tests.el @@ -133,8 +133,7 @@ (rustic-cargo-build) (let* ((proc (get-process rustic-compilation-process-name)) (buffer (process-buffer proc))) - (while (eq (process-status proc) 'run) - (sit-for 0.01)) + (rustic-test--wait-till-finished buffer) (with-current-buffer buffer (goto-char (point-min)) (when (re-search-forward "-->") From adf369070a3119b914832b656196fec10cc52406 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 10:43:14 +0530 Subject: [PATCH 30/31] Update changelog --- CHANGELOG.org | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.org b/CHANGELOG.org index 92967125..232f9895 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -6,3 +6,4 @@ - Create a new babel variable to create temporary directory and not rely on babel's internal stuff. This was needed to fix the tests. - Fix flaky tests. +- Enable tests for Emacs 29.1 From 5fb361c8aac26d3197cbb5444acb269f3398572f Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Feb 2024 10:51:59 +0530 Subject: [PATCH 31/31] Update pinned rustc to latest stable --- .github/workflows/test.yml | 2 +- CHANGELOG.org | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c02726f..2071e94e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.74.1 + toolchain: 1.76.0 components: clippy, rustfmt - name: Run tests diff --git a/CHANGELOG.org b/CHANGELOG.org index 232f9895..5bff4423 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -7,3 +7,4 @@ rely on babel's internal stuff. This was needed to fix the tests. - Fix flaky tests. - Enable tests for Emacs 29.1 +- Update rustc to 1.76.0