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

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

[elpa] master 03f8dca 32/40: tests: Add line wrapping tests


From: Daiki Ueno
Subject: [elpa] master 03f8dca 32/40: tests: Add line wrapping tests
Date: Fri, 22 Jan 2016 22:48:46 +0000

branch: master
commit 03f8dca09e2498b8325b3583d481ef33c84bf2f0
Author: Daiki Ueno <address@hidden>
Commit: Daiki Ueno <address@hidden>

    tests: Add line wrapping tests
---
 gnome-c-tests.el |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/gnome-c-tests.el b/gnome-c-tests.el
index 59ae8ee..3b48463 100644
--- a/gnome-c-tests.el
+++ b/gnome-c-tests.el
@@ -78,6 +78,34 @@ int *bar (const char * const **a,
           int                  b);
 ")
 
+(defconst gnome-c-test-program-6 "\
+int foo (char **a, int b);
+type_1234567890 bar (char a, int b);
+int identifier_1234567890 (double a, double b);
+")
+
+(defconst gnome-c-test-program-6-aligned-1 "\
+int             foo
+                (char **a,
+                 int    b);
+type_1234567890 bar
+                (char   a,
+                 int    b);
+int             identifier_1234567890
+                (double a,
+                 double b);
+")
+
+(defconst gnome-c-test-program-6-aligned-2 "\
+int             foo (char **a,
+                     int    b);
+type_1234567890 bar (char   a,
+                     int    b);
+int             identifier_1234567890
+                    (double a,
+                     double b);
+")
+
 (ert-deftest gnome-c-test-align--guess-optimal-columns ()
   "Tests the `gnome-c-align--guess-optimal-columns'."
   (with-temp-buffer
@@ -120,6 +148,26 @@ int *bar (const char * const **a,
       (gnome-c-align-decls-region (point-min) (point-max)))
     (should (equal (buffer-string) gnome-c-test-program-5-aligned))))
 
+(ert-deftest gnome-c-test-align-region-4 ()
+  "Tests the `gnome-c-align-decls-region', with max columns set."
+  (with-temp-buffer
+    (insert gnome-c-test-program-6)
+    (c-mode)
+    (let ((gnome-c-align-max-column 20))
+      (gnome-c-align-guess-optimal-columns (point-min) (point-max))
+      (gnome-c-align-decls-region (point-min) (point-max)))
+    (should (equal (buffer-string) gnome-c-test-program-6-aligned-1))))
+
+(ert-deftest gnome-c-test-align-region-5 ()
+  "Tests the `gnome-c-align-decls-region', with max columns set."
+  (with-temp-buffer
+    (insert gnome-c-test-program-6)
+    (c-mode)
+    (let ((gnome-c-align-max-column 30))
+      (gnome-c-align-guess-optimal-columns (point-min) (point-max))
+      (gnome-c-align-decls-region (point-min) (point-max)))
+    (should (equal (buffer-string) gnome-c-test-program-6-aligned-2))))
+
 (ert-deftest gnome-c-test-align-guess-columns-1 ()
   "Tests the `gnome-c-align-guess-columns'."
   (with-temp-buffer



reply via email to

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