diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/cc-mode-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/progmodes/cc-mode-tests.el b/test/lisp/progmodes/cc-mode-tests.el index 0729841ce6f..ad7a52b40d9 100644 --- a/test/lisp/progmodes/cc-mode-tests.el +++ b/test/lisp/progmodes/cc-mode-tests.el | |||
| @@ -78,4 +78,25 @@ | |||
| 78 | (insert macro-string) | 78 | (insert macro-string) |
| 79 | (c-mode)))) | 79 | (c-mode)))) |
| 80 | 80 | ||
| 81 | (ert-deftest c-lineup-ternary-bodies () | ||
| 82 | "Test for c-lineup-ternary-bodies function" | ||
| 83 | (with-temp-buffer | ||
| 84 | (c-mode) | ||
| 85 | (let* ((common-prefix "int value = condition ") | ||
| 86 | (expected-column (length common-prefix))) | ||
| 87 | (dolist (test '(("? a : \n b" . nil) | ||
| 88 | ("? a \n ::b" . nil) | ||
| 89 | ("a \n : b" . nil) | ||
| 90 | ("? a \n : b" . t) | ||
| 91 | ("? ::a \n : b" . t) | ||
| 92 | ("? (p ? q : r) \n : b" . t) | ||
| 93 | ("? p ?: q \n : b" . t) | ||
| 94 | ("? p ? : q \n : b" . t) | ||
| 95 | ("? p ? q : r \n : b" . t))) | ||
| 96 | (delete-region (point-min) (point-max)) | ||
| 97 | (insert common-prefix (car test)) | ||
| 98 | (should (equal | ||
| 99 | (and (cdr test) (vector expected-column)) | ||
| 100 | (c-lineup-ternary-bodies '(statement-cont . 1)))))))) | ||
| 101 | |||
| 81 | ;;; cc-mode-tests.el ends here | 102 | ;;; cc-mode-tests.el ends here |