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

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

[nongnu] elpa/idris-mode f3a032c194 03/14: Add test for `idris-add-claus


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode f3a032c194 03/14: Add test for `idris-add-clause`
Date: Thu, 1 Dec 2022 08:02:53 -0500 (EST)

branch: elpa/idris-mode
commit f3a032c194980c9e5065d61c6518200eaefc15fe
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>

    Add test for `idris-add-clause`
---
 idris-tests.el          | 23 +++++++++++++++++++++++
 test-data/AddClause.idr |  4 ++++
 2 files changed, 27 insertions(+)

diff --git a/idris-tests.el b/idris-tests.el
index 367d4c2618..8ce7b6bd7a 100644
--- a/idris-tests.el
+++ b/idris-tests.el
@@ -178,5 +178,28 @@ remain."
       (kill-buffer buffer))
     (idris-quit)))
 
+(ert-deftest idris-test-idris-add-clause ()
+  "Test that `idris-add-clause' generates definition with hole."
+  (let ((buffer (find-file "test-data/AddClause.idr"))
+        (buffer-content (with-temp-buffer
+                          (insert-file-contents "AddClause.idr")
+                          (buffer-string))))
+    (with-current-buffer buffer
+      (goto-char (point-min))
+      (re-search-forward "test :")
+      (goto-char (match-beginning 0))
+      (funcall-interactively 'idris-add-clause nil)
+      (should (looking-at-p "test \\w+ = \\?test_rhs"))
+      (re-search-forward "(-) :")
+      (goto-char (1+ (match-beginning 0)))
+      (funcall-interactively 'idris-add-clause nil)
+      (should (looking-at-p "(-) = \\?\\w+_rhs"))
+      ;; Cleanup
+      (erase-buffer)
+      (insert buffer-content)
+      (save-buffer)
+      (kill-buffer)))
+  (idris-quit))
+
 (provide 'idris-tests)
 ;;; idris-tests.el ends here
diff --git a/test-data/AddClause.idr b/test-data/AddClause.idr
index 0df612adc6..afbb7465f0 100644
--- a/test-data/AddClause.idr
+++ b/test-data/AddClause.idr
@@ -5,3 +5,7 @@ data Test = A | B
 --++++++++++++++++
 test : Test -> Int
 
+-- Regression test for:
+-- idris-add-clause doesn't send a message when cursor is on a dash
+-- https://github.com/idris-community/idris2-mode/issues/16
+(-) : Nat



reply via email to

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