From: Stefan Kangas Date: Mon, 31 Jul 2023 11:13:33 +0000 (+0200) Subject: Convert align-tests to use erts X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3e505d36acb7510a5170fc3529fa8cf1c69e0f50;p=emacs.git Convert align-tests to use erts --- diff --git a/test/lisp/align-resources/align-post.c b/test/lisp/align-resources/align-post.c deleted file mode 100644 index 157e1d6242a..00000000000 --- a/test/lisp/align-resources/align-post.c +++ /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 index e0ea8e727f1..00000000000 --- a/test/lisp/align-resources/align-post.java +++ /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 index b1774181a40..00000000000 --- a/test/lisp/align-resources/align-pre.c +++ /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 index fe7a87a9393..00000000000 --- a/test/lisp/align-resources/align-pre.java +++ /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 index 00000000000..0a0fa046b34 --- /dev/null +++ b/test/lisp/align-resources/c-mode.erts @@ -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 index 00000000000..693a4123121 --- /dev/null +++ b/test/lisp/align-resources/java-mode.erts @@ -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; +} +=-=-= diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el index 62ef9cf27fa..5f9580fabf0 100644 --- a/test/lisp/align-tests.el +++ b/test/lisp/align-tests.el @@ -25,22 +25,18 @@ (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)