=== modified file 'test/indent/Makefile' --- test/indent/Makefile 2010-08-30 20:34:52 +0000 +++ test/indent/Makefile 2011-06-01 20:48:21 +0000 @@ -13,3 +13,6 @@ --eval '(indent-region (point-min) (point-max) nil)' \ --eval '(write-region (point-min) (point-max) "$<.new")' diff -u -B $< $<.new + +test-indent: + $(EMACS) --batch -l ert -l test-indent.el -f ert-run-tests-batch-and-exit === added file 'test/indent/test-indent.el' --- test/indent/test-indent.el 1970-01-01 00:00:00 +0000 +++ test/indent/test-indent.el 2011-06-01 21:28:07 +0000 @@ -0,0 +1,57 @@ +;;; test-indent.el --- run indentation tests + +;; Copyright (C) 2011 Free Software Foundation, Inc. + +;; Author: Ted Zlatanov + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; The purpose of this module is to verify that all the files in te +;; current directory are indented correctly. + +;;; Code: + +(eval-when-compile + (require 'ert) + (require 'cl)) + +(ert-deftest test-indent-all () + (let ((enable-local-variables :all) + lnum) + (loop for f in (delete "test-indent.el" + (directory-files "." nil "^[^.]+\\.")) + do (with-temp-buffer + (message "Testing indentation of %s" f) + (insert-file-contents f) + (goto-char (point-min)) + (setq lnum 0) + (while (not (eobp)) + (incf lnum) + (let* ((a (line-beginning-position)) + (b (line-end-position)) + (line (buffer-substring a b))) + (message "Testing indentation of %s:%05d: %s" f lnum line) + (unless (string-match "KNOWN INDENT BUG" line) + (indent-region a b nil) + (should (equal line (buffer-substring + (line-beginning-position) + (line-end-position))))) + (forward-line))))))) + +(provide 'test-indent) +;;; test-indent.el ends here