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

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

[elpa] externals/phps-mode 5c0568b 033/405: Added some basic unit tests


From: Stefan Monnier
Subject: [elpa] externals/phps-mode 5c0568b 033/405: Added some basic unit tests for indentation
Date: Sat, 13 Jul 2019 09:59:34 -0400 (EDT)

branch: externals/phps-mode
commit 5c0568bac426fb2724a7741293f9040c1fdb431d
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Added some basic unit tests for indentation
---
 phps-test-functions.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/phps-test-functions.el b/phps-test-functions.el
index c25f820..891c541 100644
--- a/phps-test-functions.el
+++ b/phps-test-functions.el
@@ -42,6 +42,7 @@
 
 (defun phps-mode/test-indentation ()
   "Test for indentation."
+
   (phps-mode/with-test-buffer
    "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title;\n\n} ?></title><body>Bla bla</body></html>"
    (goto-char 69)
@@ -50,23 +51,28 @@
      (should (equal buffer-contents  "<html><head><title><?php if 
($myCondition) {\n    if ($mySeconCondition) {\necho $title;\n\n} 
?></title><body>Bla bla</body></html>"))))
 
   (phps-mode/with-test-buffer
-   "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title;\n\n} ?></title><body>Bla bla</body></html>"
-   (goto-char 80)
+   "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title;\n} ?></title><body>Bla bla</body></html>"
+   
+   (goto-char 75)
    (phps-mode/indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
-     (should (equal buffer-contents  "<html><head><title><?php if 
($myCondition) {\nif ($mySeconCondition) {\n        echo $title;\n\n} 
?></title><body>Bla bla</body></html>"))))
+     (should (equal buffer-contents  "<html><head><title><?php if 
($myCondition) {\nif ($mySeconCondition) {\n        echo $title;\n} 
?></title><body>Bla bla</body></html>"))))
 
   (phps-mode/with-test-buffer
    "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title;\n\n} ?></title><body>Bla bla</body></html>"
+
    (goto-char 98)
    (phps-mode/indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
-     (should (equal buffer-contents  "<html><head><title><?php if  
($myCondition) {\nif ($mySeconCondition) {\necho $title;\n\n} 
?></title><body>Bla bla</body></html>"))))
+     (should (equal buffer-contents  "<html><head><title><?php if 
($myCondition) {\nif ($mySeconCondition) {\necho $title;\n\n        } 
?></title><body>Bla bla</body></html>"))))
 
   )
 
 (defun phps-mod/test-functions ()
   "Run test for functions."
+  (setq-default indent-tabs-mode nil)
+  (setq-default tab-width 4)
+  (setq-default c-basic-indent 4)
   (phps-mode/test-indentation))
 
 (phps-mod/test-functions)



reply via email to

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