[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/assess 196470b1e1 08/95: New function buffer-string=
From: |
ELPA Syncer |
Subject: |
[elpa] externals/assess 196470b1e1 08/95: New function buffer-string= |
Date: |
Tue, 19 Jul 2022 15:57:28 -0400 (EDT) |
branch: externals/assess
commit 196470b1e1c28968ce02bc777c13a53c03b1b07b
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>
New function buffer-string=
Compares the contents of a buffer with a string.
---
Cask | 2 +-
sisyphus.el | 16 ++++++++++++++--
test/sisyphus-test.el | 50 ++++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 59 insertions(+), 9 deletions(-)
diff --git a/Cask b/Cask
index 7430091a46..4c185b2828 100644
--- a/Cask
+++ b/Cask
@@ -1,5 +1,5 @@
(source gnu)
-(source melpa-stable)
+(source melpa)
(package-file "sisyphus.el")
diff --git a/sisyphus.el b/sisyphus.el
index 5daf94f548..c4582e5826 100644
--- a/sisyphus.el
+++ b/sisyphus.el
@@ -47,6 +47,7 @@
;; #+begin_src emacs-lisp
(require 'pp)
(require 'ert)
+(require 'm-buffer-at)
;; #+end_src
;; ** Advice
@@ -156,14 +157,25 @@ print any messages!."
;; #+begin_src emacs-lisp
(defun sisyphus-buffer-string= (buffer string)
(string=
- (m-buffer-at-substring buffer)
+ (m-buffer-at-string buffer)
string))
+(defun sisyphus-explain-buffer-string= (buffer string)
+ (sisyphus-explain-string=
+ (m-buffer-at-string buffer)
+ string))
+
+(put 'sisyphus-buffer-string=
+ 'ert-explainer
+ 'sisyphus-explain-buffer-string=)
+
;; #+end_src
-;; Compare string to buffer
;; Compare buffer to buffer
+;; #+begin_src emacs-lisp
+
+;; #+end_src
;; Compare string to file
diff --git a/test/sisyphus-test.el b/test/sisyphus-test.el
index d7967b78f5..c4555fb359 100644
--- a/test/sisyphus-test.el
+++ b/test/sisyphus-test.el
@@ -18,14 +18,14 @@
(require 'sisyphus)
(require 'cl-lib)
-(defun sisyphus-test--plist-from-test (result)
+(defun sisyphus-test--plist-from-result (result)
(cl-cdadr
(ert-test-result-with-condition-condition result)))
(ert-deftest plist-extraction ()
(should
(equal
- (sisyphus-test--plist-from-test
+ (sisyphus-test--plist-from-result
(ert-run-test
(make-ert-test
:body
@@ -34,16 +34,16 @@
(eq 1 2))))))
'(:form (eq 1 2) :value nil))))
-(defun sisyphus-test--explanation-from-test (result)
+(defun sisyphus-test--explanation-from-result (result)
(plist-get
- (sisyphus-test--plist-from-test result)
+ (sisyphus-test--plist-from-result result)
:explanation))
-(ert-deftest explanation-extraction ()
+(ert-deftest explanation-extraction-from-result ()
"Test that explanation is extractable from failing test.
This also tests the advice on string=."
(should
- (sisyphus-test--explanation-from-test
+ (sisyphus-test--explanation-from-result
(ert-run-test
(make-ert-test
:body
@@ -57,3 +57,41 @@ This also tests the advice on string=."
(string= "1" "1"))
(should-not
(string= "1" "2")))
+
+(defun sisyphus-test--explanation (f)
+ (sisyphus-test--explanation-from-result
+ (ert-run-test
+ (make-ert-test
+ :body f))))
+
+(ert-deftest explanation-extraction ()
+ "Test that explanation is extractable from failing test.
+This also tests the advice on string=."
+ (should
+ (sisyphus-test--explanation
+ (lambda ()
+ (should
+ (string= "1" "2"))))))
+
+(ert-deftest buffer-string= ()
+ (with-temp-buffer
+ (insert "hello")
+ (should
+ (sisyphus-buffer-string=
+ (current-buffer)
+ "hello")))
+ (with-temp-buffer
+ (insert "goodbye")
+ (should-not
+ (sisyphus-buffer-string=
+ (current-buffer)
+ "hello")))
+ (should
+ (sisyphus-test--explanation
+ (lambda ()
+ (with-temp-buffer
+ (insert "goodbye")
+ (should
+ (sisyphus-buffer-string=
+ (current-buffer)
+ "hello")))))))
- [elpa] branch externals/assess created (now 44083d94fe), ELPA Syncer, 2022/07/19
- [elpa] externals/assess 41a297b066 01/95: Initial Checkin, ELPA Syncer, 2022/07/19
- [elpa] externals/assess 8eb105f351 02/95: Travis Build status, ELPA Syncer, 2022/07/19
- [elpa] externals/assess 3d659897df 03/95: Require cl-lib, local emacs test override., ELPA Syncer, 2022/07/19
- [elpa] externals/assess af38180b77 10/95: buffer= and file-string= functions added., ELPA Syncer, 2022/07/19
- [elpa] externals/assess eb3336543c 13/95: declare debug for `sisyphus-with-preserved-buffer-list'., ELPA Syncer, 2022/07/19
- [elpa] externals/assess af8b3a8d8b 14/95: with-temp-buffers now works like let., ELPA Syncer, 2022/07/19
- [elpa] externals/assess 238d9028e2 19/95: Support for indentation checking., ELPA Syncer, 2022/07/19
- [elpa] externals/assess b3f9a7cf97 04/95: Require cl-lib, local emacs test override., ELPA Syncer, 2022/07/19
- [elpa] externals/assess 196470b1e1 08/95: New function buffer-string=,
ELPA Syncer <=
- [elpa] externals/assess dae3a60f7a 09/95: Docstring fix., ELPA Syncer, 2022/07/19
- [elpa] externals/assess c6e666413a 21/95: Merge branch 'master' of github.com:phillord/sisyphus, ELPA Syncer, 2022/07/19
- [elpa] externals/assess 83973f4047 23/95: Add dash as a dependency., ELPA Syncer, 2022/07/19
- [elpa] externals/assess f33b371177 25/95: Specify minimum dash version, ELPA Syncer, 2022/07/19
- [elpa] externals/assess 3e74c4b70d 30/95: Add test for string font-lock comparison., ELPA Syncer, 2022/07/19
- [elpa] externals/assess 6a4aa34ec3 33/95: Fixed multiple string matching for face match., ELPA Syncer, 2022/07/19
- [elpa] externals/assess 5dde98a124 31/95: Merge branch 'master' of github.com:phillord/sisyphus, ELPA Syncer, 2022/07/19
- [elpa] externals/assess 0eb198f05e 40/95: Documentation Fix., ELPA Syncer, 2022/07/19
- [elpa] externals/assess c0bdc94e49 41/95: Remove erroneous debug statement., ELPA Syncer, 2022/07/19
- [elpa] externals/assess 2db9834e4e 44/95: Rework Makefile for update to cask, ELPA Syncer, 2022/07/19