]> git.eshelyaron.com Git - emacs.git/commitdiff
Convert align-tests to use erts
authorStefan Kangas <stefankangas@gmail.com>
Mon, 31 Jul 2023 11:13:33 +0000 (13:13 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Tue, 1 Aug 2023 08:38:42 +0000 (10:38 +0200)
test/lisp/align-resources/align-post.c [deleted file]
test/lisp/align-resources/align-post.java [deleted file]
test/lisp/align-resources/align-pre.c [deleted file]
test/lisp/align-resources/align-pre.java [deleted file]
test/lisp/align-resources/c-mode.erts [new file with mode: 0644]
test/lisp/align-resources/java-mode.erts [new file with mode: 0644]
test/lisp/align-tests.el

diff --git a/test/lisp/align-resources/align-post.c b/test/lisp/align-resources/align-post.c
deleted file mode 100644 (file)
index 157e1d6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-int
-main (int       argc,
-      char     *argv[]);
diff --git a/test/lisp/align-resources/align-post.java b/test/lisp/align-resources/align-post.java
deleted file mode 100644 (file)
index e0ea8e7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class X
-{
-    String     field1;
-    String[]   field2;
-    int                field3;
-    int[]      field4;
-    X          field5;
-    X[]                field6;
-}
diff --git a/test/lisp/align-resources/align-pre.c b/test/lisp/align-resources/align-pre.c
deleted file mode 100644 (file)
index b177418..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-int
-main (int argc,
-      char *argv[]);
diff --git a/test/lisp/align-resources/align-pre.java b/test/lisp/align-resources/align-pre.java
deleted file mode 100644 (file)
index fe7a87a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class X
-{
-    String     field1;
-    String[] field2;
-    int                field3;
-    int[] field4;
-    X          field5;
-    X[] field6;
-}
diff --git a/test/lisp/align-resources/c-mode.erts b/test/lisp/align-resources/c-mode.erts
new file mode 100644 (file)
index 0000000..0a0fa04
--- /dev/null
@@ -0,0 +1,11 @@
+Name: align function declaration
+
+=-=
+int
+main (int argc,
+      char *argv[]);
+=-=
+int
+main (int       argc,
+      char     *argv[]);
+=-=-=
diff --git a/test/lisp/align-resources/java-mode.erts b/test/lisp/align-resources/java-mode.erts
new file mode 100644 (file)
index 0000000..693a412
--- /dev/null
@@ -0,0 +1,23 @@
+Name: align class fields
+
+=-=
+class X
+{
+    String     field1;
+    String[] field2;
+    int                field3;
+    int[] field4;
+    X          field5;
+    X[] field6;
+}
+=-=
+class X
+{
+    String     field1;
+    String[]   field2;
+    int                field3;
+    int[]      field4;
+    X          field5;
+    X[]                field6;
+}
+=-=-=
index 62ef9cf27fa54623dd023c727bc54c705cf81fe1..5f9580fabf096f30567e55b4af3fe3b7e30ed3fa 100644 (file)
 (require 'ert-x)
 (require 'align)
 
-(defun test-align-compare (file function)
-  (should (equal
-           (with-temp-buffer
-             (insert-file-contents (ert-resource-file (format file "pre")))
-             (funcall function)
-             (align (point-min) (point-max))
-             (buffer-substring-no-properties (point-min) (point-max)))
-           (with-temp-buffer
-             (insert-file-contents (ert-resource-file (format file "post")))
-             (buffer-string)))))
-
-(ert-deftest align-java ()
-  (test-align-compare "align-%s.java" #'java-mode))
+(defun test-align-transform-fun (function)
+  (lambda ()
+    (funcall function)
+    (align (point-min) (point-max))))
 
 (ert-deftest align-c ()
-  (test-align-compare "align-%s.c" #'c-mode))
+  (ert-test-erts-file (ert-resource-file "c-mode.erts")
+                      (test-align-transform-fun #'c-mode)))
+
+(ert-deftest align-java ()
+  (ert-test-erts-file (ert-resource-file "java-mode.erts")
+                      (test-align-transform-fun #'java-mode)))
 
 (provide 'align-tests)