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 SXEmacs.
12 ;; SXEmacs is free software: you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by the
14 ;; Free Software Foundation, either version 3 of the License, or (at your
15 ;; option) any later version.
17 ;; SXEmacs is distributed in the hope that it will be
18 ;; useful, but 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 this program. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Synched up with: Not in FSF.
29 ;; Test OS support. Processes, environment variables, etc.
30 ;; See test-harness.el for instructions on how to run these tests.
32 ;; call-process-region bug reported by Katsumi Yamaoka on 2004-10-26
33 ;; in <b9yvfcyuscf.fsf@jpl.org>, who suggested the basic test scheme
34 ;; in <b9yoeipvwn0.fsf@jpl.org>.
36 (and-fboundp 'executable-find
37 ;; tac works by lines, unfortunately
38 (let* ((original-string "a\nb\nc\nd\n")
39 (tac-cases (if (executable-find "tac")
40 '((1 . "c\nb\na\nd\n")
46 (cat-cases (if (executable-find "cat")
47 '((1 . "b\nc\na\nd\n")
55 (Skip-Test-Unless tac-cases
56 "tac executable not found"
57 "Tests of call-process-region with region deleted after inserting
59 (setq cases tac-cases)
61 (setq case (car cases)
63 (flet ((do-test (pos result)
65 (insert original-string)
67 (call-process-region 3 7 "tac" t t)
68 (goto-char (point-min))
69 (Assert (looking-at result))))
70 (do-test (car case) (cdr case)))))
71 ;; if you're in that much of a hurry you can blow cat off
72 ;; if you've done tac, but I'm not going to bother
73 (Skip-Test-Unless cat-cases
74 "cat executable not found"
75 "Tests of call-process-region with region deleted after inserting
77 (setq cases cat-cases)
79 (setq case (car cases)
81 (flet ((do-test (pos result)
83 (insert original-string)
85 (call-process-region 3 7 "cat" t t)
86 (goto-char (point-min))
87 (Assert (looking-at result))))
88 (do-test (car case) (cdr case))))))))
90 ;;; end of os-tests.el