Patchwork test-editor-filename: fix portability of fake editor command

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 2, 2017, 12:52 p.m.
Message ID <4bf1889456f3550c7adf.1504356725@mimosa>
Download mbox | patch
Permalink /patch/23625/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 2, 2017, 12:52 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504356585 -32400
#      Sat Sep 02 21:49:45 2017 +0900
# Node ID 4bf1889456f3550c7adf10b9a14c0afd4d3a6420
# Parent  da13616d1a922831bb80d0380ac10326acbaed06
test-editor-filename: fix portability of fake editor command

 - /bin/bash doesn't exist on FreeBSD
 - edit is executed by cmd.exe on Windows
Augie Fackler - Sept. 2, 2017, 3:01 p.m.
> On Sep 2, 2017, at 8:52 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1504356585 -32400
> #      Sat Sep 02 21:49:45 2017 +0900
> # Node ID 4bf1889456f3550c7adf10b9a14c0afd4d3a6420
> # Parent  da13616d1a922831bb80d0380ac10326acbaed06
> test-editor-filename: fix portability of fake editor command

queued, thanks

Patch

diff --git a/tests/test-editor-filename.t b/tests/test-editor-filename.t
--- a/tests/test-editor-filename.t
+++ b/tests/test-editor-filename.t
@@ -5,20 +5,18 @@  Test temp file used with an editor has t
 Create an editor that writes its arguments to stdout and set it to $HGEDITOR.
 
   $ cat > editor.sh << EOF
-  > #!/bin/bash
   > echo "\$@"
   > exit 1
   > EOF
-  $ chmod +x editor.sh
   $ hg add editor.sh
-  $ HGEDITOR=$TESTTMP/editor.sh
+  $ HGEDITOR="sh $TESTTMP/editor.sh"
   $ export HGEDITOR
 
 Verify that the path for a commit editor has the expected suffix.
 
   $ hg commit
   *.commit.hg.txt (glob)
-  abort: edit failed: editor.sh exited with status 1
+  abort: edit failed: sh exited with status 1
   [255]
 
 Verify that the path for a histedit editor has the expected suffix.
@@ -31,7 +29,7 @@  Verify that the path for a histedit edit
   $ hg commit --message 'At least one commit for histedit.'
   $ hg histedit
   *.histedit.hg.txt (glob)
-  abort: edit failed: editor.sh exited with status 1
+  abort: edit failed: sh exited with status 1
   [255]
 
 Verify that when performing an action that has the side-effect of creating an