1 ;;; os-tests.el --- test support for OS interaction
3 ;; Copyright (C) 2004 Free Software Foundation
5 ;; Author: Stephen J. Turnbull <stephen@xemacs.org>
6 ;; Maintainer: Stephen J. Turnbull <stephen@xemacs.org>
7 ;; Created: 2004 October 28
8 ;; Keywords: tests, process support
10 ;; This file is part of XEmacs.
12 ;; XEmacs is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; XEmacs is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 ;;; Synched up with: Not in FSF.
31 ;; Test OS support. Processes, environment variables, etc.
32 ;; See test-harness.el for instructions on how to run these tests.
34 ;; call-process-region bug reported by Katsumi Yamaoka on 2004-10-26
35 ;; in <b9yvfcyuscf.fsf@jpl.org>, who suggested the basic test scheme
36 ;; in <b9yoeipvwn0.fsf@jpl.org>.
38 ;; tac works by lines, unfortunately
39 (let* ((original-string "a\nb\nc\nd\n")
40 (tac-cases (if (executable-find "tac")
41 '((1 . "c\nb\na\nd\n")
47 (cat-cases (if (executable-find "cat")
48 '((1 . "b\nc\na\nd\n")
56 (Skip-Test-Unless tac-cases
57 "tac executable not found"
58 "Tests of call-process-region with region deleted after inserting
60 (setq cases tac-cases)
62 (setq case (car cases)
64 (flet ((do-test (pos result)
66 (insert original-string)
68 (call-process-region 3 7 "tac" t t)
69 (goto-char (point-min))
70 (Assert (looking-at result))))
71 (do-test (car case) (cdr case)))))
72 ;; if you're in that much of a hurry you can blow cat off
73 ;; if you've done tac, but I'm not going to bother
74 (Skip-Test-Unless cat-cases
75 "cat executable not found"
76 "Tests of call-process-region with region deleted after inserting
78 (setq cases cat-cases)
80 (setq case (car cases)
82 (flet ((do-test (pos result)
84 (insert original-string)
86 (call-process-region 3 7 "cat" t t)
87 (goto-char (point-min))
88 (Assert (looking-at result))))
89 (do-test (car case) (cdr case)))))))
91 ;;; end of os-tests.el