diff options
| author | Helmut Eller | 2026-02-13 09:10:16 +0100 |
|---|---|---|
| committer | Helmut Eller | 2026-02-13 09:10:16 +0100 |
| commit | 91c9e9883488d715a30877dfd7641ef4b3c62658 (patch) | |
| tree | e2c4525147e443f86baf9d0144aeadec082d7564 /test/lisp/align-tests.el | |
| parent | 9a4a54af9192a6653164364c75721ee814ffb1e8 (diff) | |
| parent | f1fe4d46190263e164ccd1e066095d46a156297f (diff) | |
| download | emacs-feature/igc.tar.gz emacs-feature/igc.zip | |
Merge branch 'master' into feature/igcfeature/igc
Diffstat (limited to 'test/lisp/align-tests.el')
| -rw-r--r-- | test/lisp/align-tests.el | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el index 92605a7f4aa..43660f8de87 100644 --- a/test/lisp/align-tests.el +++ b/test/lisp/align-tests.el | |||
| @@ -36,6 +36,53 @@ | |||
| 36 | (ert-test-erts-file (ert-resource-file "c-mode.erts") | 36 | (ert-test-erts-file (ert-resource-file "c-mode.erts") |
| 37 | (test-align-transform-fun #'c-mode))) | 37 | (test-align-transform-fun #'c-mode))) |
| 38 | 38 | ||
| 39 | (ert-deftest align-c-multi-section () | ||
| 40 | "Test alignment of multiple sections in C code. | ||
| 41 | Regression test for bug where positions become stale after earlier | ||
| 42 | sections are aligned, causing incorrect alignment in later sections." | ||
| 43 | (let ((input "int main(void) | ||
| 44 | { | ||
| 45 | long signed int foo = 5; | ||
| 46 | int bar = 7; | ||
| 47 | { | ||
| 48 | int a1 = 4; | ||
| 49 | int b1 = 2; | ||
| 50 | long signed int junk1 = 2; | ||
| 51 | } | ||
| 52 | { | ||
| 53 | int a2 = 4; /* comment */ | ||
| 54 | int b2 = 2; | ||
| 55 | long signed int junk2 = 2; /* another comment */ | ||
| 56 | } | ||
| 57 | |||
| 58 | return 0; | ||
| 59 | } | ||
| 60 | ") | ||
| 61 | (expected "int main(void) | ||
| 62 | { | ||
| 63 | long signed int foo = 5; | ||
| 64 | int bar = 7; | ||
| 65 | { | ||
| 66 | int a1 = 4; | ||
| 67 | int b1 = 2; | ||
| 68 | long signed int junk1 = 2; | ||
| 69 | } | ||
| 70 | { | ||
| 71 | int a2 = 4; /* comment */ | ||
| 72 | int b2 = 2; | ||
| 73 | long signed int junk2 = 2; /* another comment */ | ||
| 74 | } | ||
| 75 | |||
| 76 | return 0; | ||
| 77 | } | ||
| 78 | ")) | ||
| 79 | (with-temp-buffer | ||
| 80 | (c-mode) | ||
| 81 | (setq indent-tabs-mode nil) | ||
| 82 | (insert input) | ||
| 83 | (align (point-min) (point-max)) | ||
| 84 | (should (equal (buffer-string) expected))))) | ||
| 85 | |||
| 39 | (ert-deftest align-css () | 86 | (ert-deftest align-css () |
| 40 | (let ((indent-tabs-mode nil)) | 87 | (let ((indent-tabs-mode nil)) |
| 41 | (ert-test-erts-file (ert-resource-file "css-mode.erts") | 88 | (ert-test-erts-file (ert-resource-file "css-mode.erts") |