comparison tests/automated/process-tests.el @ 5687:965a9ddc915a

Introduce call-process-shell-command from GNU. Thanks GNU. Used in recent versions of org-mode. 2012-10-13 Mats Lidell <matsl@xemacs.org> * process.el (call-process-shell-command): New function from GNU. 2012-10-13 Mats Lidell <matsl@xemacs.org> * lispref/processes.texi (Synchronous Processes): New function call-process-shell-command. 2012-10-13 Mats Lidell <matsl@xemacs.org> * automated/process-tests.el: Simple test cases for call-process-shell-command.
author Mats Lidell <matsl@xemacs.org>
date Sat, 13 Oct 2012 01:09:35 +0200
parents 11da5b828d10
children 7addb3dbe4b4
comparison
equal deleted inserted replaced
5686:c6b1500299a7 5687:965a9ddc915a
1 ;; Copyright (C) 2011 Free Software Foundation, Inc. 1 ;; Copyright (C) 2011, 2012 Free Software Foundation, Inc.
2 2
3 ;; Author: Mats Lidell <matsl@xemacs.org> 3 ;; Author: Mats Lidell <matsl@xemacs.org>
4 ;; Maintainer: 4 ;; Maintainer:
5 ;; Created: 2011 5 ;; Created: 2011
6 ;; Keywords: tests 6 ;; Keywords: tests
65 ;; Output to stderr but no error buffer 65 ;; Output to stderr but no error buffer
66 (Assert (= 0 (shell-command "echo -e \"foobar\nfoobar\n\" 1>&2" "Output buffer"))) 66 (Assert (= 0 (shell-command "echo -e \"foobar\nfoobar\n\" 1>&2" "Output buffer")))
67 (with-current-buffer "Output buffer" 67 (with-current-buffer "Output buffer"
68 (goto-char (point-min)) 68 (goto-char (point-min))
69 (Assert (looking-at "foobar"))) 69 (Assert (looking-at "foobar")))
70 ) 70 )
71
72 ;; call-process-shell-command
73 (when (equal system-type 'linux)
74 (setenv "LANG" "C")
75
76 ;; Output one line
77 (Assert (= 0 (call-process-shell-command "echo hello")))
78
79 ;; Output to stderr but no error buffer
80 (Assert (= 0 (call-process-shell-command "echo -e \"barefoot\nfoobar\n\" 1>&2" nil "Output buffer")))
81 (with-current-buffer "Output buffer"
82 (goto-char (point-min))
83 (Assert (looking-at "barefoot\n")))
84 )