File edit-01-test-file-creation.patch of Package quilt

From: Jean Delvare <jdelvare@suse.de>
Subject: edit: Improve the test case
Upstream: Submitted (2011-02-11)

Cover one more use case of the "edit" command in the test case: file
creation.

Also reorder some of the commands to make the tests easier to follow.
The intent is easier to understand when the result is tested after
each command.
---
 test/edit.test |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

--- a/test/edit.test
+++ b/test/edit.test
@@ -1,5 +1,6 @@
 $ mkdir patches subdir
 
+# Test the behavior if the editor modifies existing files
 $ cat > editor
 < #! /bin/sh
 < echo Editing $1
@@ -16,15 +17,15 @@ $ quilt edit foobar
 > File foobar added to patch patches/patch
 > Editing foobar
 
+$ cat foobar
+> barbar
+
 $ cd subdir
 $ echo foo > foo
 $ quilt edit foo
 > File subdir/foo added to patch ../patches/patch
 > Editing subdir/foo
-
 $ cd ..
-$ cat foobar
-> barbar
 
 $ cat subdir/foo
 > bar
@@ -32,3 +33,23 @@ $ cat subdir/foo
 $ quilt files
 > foobar
 > subdir/foo
+
+$ quilt refresh
+> Refreshed patch patches/patch
+
+# Test the behavior if the editor creates a brand new file
+$ cat > editor
+< #! /bin/sh
+< echo Creating $1
+< echo "new line" > $1
+
+$ quilt edit foo2
+> File foo2 added to patch patches/patch
+> Creating foo2
+$ cat foo2
+> new line
+
+$ quilt files -v
+> + foo2
+>   foobar
+>   subdir/foo
openSUSE Build Service is sponsored by