unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: 1013@emacsbugs.donarmstrong.com,
	Christian Ohler <ohler+emacs@fastmail.net>
Cc: Phil Hagelberg <phil@hagelb.org>
Subject: bug#1013: 23.0.60; permanent-local not honored for word-wrap
Date: Mon, 22 Sep 2008 01:13:17 +0200	[thread overview]
Message-ID: <48D6D50D.2010507@gmail.com> (raw)
In-Reply-To: <48D6C9D9.3070302@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

Lennart Borgman (gmail) wrote:
> I played a bit with making a unit test for this, see the attached file.
> This requires the ert2.el that comes with nXhtml and should be placed in
> the same subdir as nxhtmltest-suites.el.

Here is a much better way to structure the test. To test it:

- Put emacstest-suites.el in nxhtml/test/
- Put bug1013.el in nxhtml/test/inemacs/
- M-x emacstest-run

If we include ert.el + ert2.el in Emacs we could write unit tests like
this for bug reports.

Christian, any thoughts?

[-- Attachment #2: emacstest-suites.el --]
[-- Type: text/plain, Size: 2949 bytes --]

;;; emacstest-suites.el --- Some unit tests for Emacs
;;
;; Author: Lennart Borgman (lennart O borgman A gmail O com)
;; Created: 2008-09-21T22:34:11+0200 Sun
;; Version:
;; Last-Updated: 2008-09-22T00:36:11+0200 Sun
;; URL:
;; Keywords:
;; Compatibility:
;;
;; Features that might be required by this library:
;;
;;   `button', `cl', `debug', `ert', `ert2', `ewoc', `find-func',
;;   `help-fns', `help-mode', `view'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Unit tests for some Emacs bug reports.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program 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 2, or
;; (at your option) any later version.
;;
;; This program 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 this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:

(eval-when-compile (require 'cl))

(setq debug-on-error t)

(defvar emacstest-bin
  (file-name-directory (if load-file-name load-file-name buffer-file-name)))

(pushnew emacstest-bin load-path)
(require 'ert2)


(defvar emacstest-files-root
  (let* ((this-dir emacstest-bin)
         (root (expand-file-name "inemacs/" this-dir)))
    (unless (file-accessible-directory-p root)
          (error (if (file-exists-p root)
                     "Can't read files in test directory %s"
                   "Can't find test directory %s")
                 root))
    root))

(let ((distr-in "c:/EmacsW32/nxhtml/tests/inemacs/"))
  (when (file-directory-p distr-in)
    (setq emacstest-files-root distr-in)))

(defun emacstest-run ()
  "Run Emacs tests."
  (interactive)
  (setq message-log-max t)
  (setq ert-test-files-root emacstest-files-root)
  (let ((selector "emacs-"))
    (if noninteractive
        (ert-run-tests-batch selector)
      (ert-kill-temp-test-buffers)
      (ert-run-tests-interactively selector)
      (other-window 1)
      (ert-list-temp-test-buffers))))

(ert-deftest emacs-bug1013 ()
  "Emacs bug 1013.
See URL
`http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1013'."
  (ert-with-temp-buffer-include-file "bug1013.el"
    (eval-buffer)))

(provide 'emacstest-suites)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; emacstest-suites.el ends here

[-- Attachment #3: bug1013.el --]
[-- Type: text/plain, Size: 709 bytes --]

;; Setup
(defvar word-wrap2 nil)
(make-variable-buffer-local 'word-wrap2)
(set-default 'word-wrap2 nil)

(defcustom word-wrap3 nil
  "doc 3"
  :type 'boolean)
(make-variable-buffer-local 'word-wrap3)
(set-default 'word-wrap3 nil)

(set-default 'word-wrap nil)

(put 'word-wrap  'permanent-local t)
(put 'word-wrap2 'permanent-local t)
(put 'word-wrap3 'permanent-local t)

(setq word-wrap t)
(setq word-wrap2 t)
(setq word-wrap3 t)

(kill-all-local-variables)
;; Test
(ert-should (eq (default-value 'word-wrap3) nil))
(ert-should (eq word-wrap3 t))
(ert-should (eq (default-value 'word-wrap2) nil))
(ert-should (eq word-wrap2 t))
(ert-should (eq (default-value 'word-wrap) nil))
(ert-should (eq word-wrap t))

  reply	other threads:[~2008-09-21 23:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jwvmyi07tgx.fsf-monnier+emacsbugreports@gnu.org>
2008-09-21 20:31 ` bug#1013: 23.0.60; permanent-local not honored for word-wrap Lennart Borgman (gmail)
2008-09-21 22:25   ` Lennart Borgman (gmail)
2008-09-21 23:13     ` Lennart Borgman (gmail) [this message]
2008-09-22  3:35   ` bug#1013: marked as done (23.0.60; permanent-local not honored for word-wrap) Emacs bug Tracking System
2008-09-22 15:59     ` martin rudalics
2008-09-23  4:30   ` Emacs bug Tracking System
     [not found] ` <48D7ADA2.4030605@gmail.com>
2008-09-22 17:38   ` bug#1013: 23.0.60; permanent-local not honored for word-wrap Stefan Monnier
2008-09-22 18:11     ` Lennart Borgman (gmail)
2008-09-23  4:30     ` Processed: " Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D6D50D.2010507@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=1013@emacsbugs.donarmstrong.com \
    --cc=ohler+emacs@fastmail.net \
    --cc=phil@hagelb.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).