* [StGIT PATCH 1/3] Make patch deletion test more specific
@ 2007-05-13 18:27 Karl Hasselström
2007-05-13 18:27 ` [StGIT PATCH 2/3] Test patch order, not just number of patches Karl Hasselström
2007-05-13 18:27 ` [StGIT PATCH 3/3] Use "stg applied" instead of reading the applied file directly Karl Hasselström
0 siblings, 2 replies; 3+ messages in thread
From: Karl Hasselström @ 2007-05-13 18:27 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
From: Karl Hasselström <kha@treskal.com>
Don't just test the number of applied and unapplied patches; also test
their name and order.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t1601-delete-many.sh | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/t/t1601-delete-many.sh b/t/t1601-delete-many.sh
index 8648ed1..8eff308 100755
--- a/t/t1601-delete-many.sh
+++ b/t/t1601-delete-many.sh
@@ -10,13 +10,13 @@ test_expect_success \
test_expect_success \
'Create five applied and five unapplied patches' \
'
- stg new foo0 -m foo0 &&
- echo foo0 > foo.txt &&
+ stg new p0 -m p0 &&
+ echo p0 > foo.txt &&
stg add foo.txt &&
stg refresh &&
for i in 1 2 3 4 5 6 7 8 9; do
- stg new foo$i -m foo$i &&
- echo foo$i >> foo.txt &&
+ stg new p$i -m p$i &&
+ echo p$i >> foo.txt &&
stg refresh;
done &&
stg pop -n 5
@@ -25,31 +25,31 @@ test_expect_success \
test_expect_success \
'Delete some patches' \
'
- [ $(stg applied | wc -l) -eq 5 ] &&
- [ $(stg unapplied | wc -l) -eq 5 ] &&
- stg delete foo7 foo6 foo3 foo4 &&
- [ $(stg applied | wc -l) -eq 3 ] &&
- [ $(stg unapplied | wc -l) -eq 3 ]
+ [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
+ [ "$(echo $(stg unapplied))" = "p5 p6 p7 p8 p9" ] &&
+ stg delete p7 p6 p3 p4 &&
+ [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "p5 p8 p9" ]
'
test_expect_success \
'Delete some more patches, some of which do not exist' \
'
- [ $(stg applied | wc -l) -eq 3 ] &&
- [ $(stg unapplied | wc -l) -eq 3 ] &&
- ! stg delete foo7 foo8 foo2 foo0 &&
- [ $(stg applied | wc -l) -eq 3 ] &&
- [ $(stg unapplied | wc -l) -eq 3 ]
+ [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "p5 p8 p9" ] &&
+ ! stg delete p7 p8 p2 p0 &&
+ [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "p5 p8 p9" ]
'
test_expect_success \
'Delete a range of patches' \
'
- [ $(stg applied | wc -l) -eq 3 ] &&
- [ $(stg unapplied | wc -l) -eq 3 ] &&
- stg delete foo1..foo8 &&
- [ $(stg applied | wc -l) -eq 1 ] &&
- [ $(stg unapplied | wc -l) -eq 1 ]
+ [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "p5 p8 p9" ] &&
+ stg delete p1..p8 &&
+ [ "$(echo $(stg applied))" = "p0" ] &&
+ [ "$(echo $(stg unapplied))" = "p9" ]
'
test_done
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [StGIT PATCH 2/3] Test patch order, not just number of patches
2007-05-13 18:27 [StGIT PATCH 1/3] Make patch deletion test more specific Karl Hasselström
@ 2007-05-13 18:27 ` Karl Hasselström
2007-05-13 18:27 ` [StGIT PATCH 3/3] Use "stg applied" instead of reading the applied file directly Karl Hasselström
1 sibling, 0 replies; 3+ messages in thread
From: Karl Hasselström @ 2007-05-13 18:27 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
From: Karl Hasselström <kha@treskal.com>
In addition to testing the number of applied patches, also test their
order. And test the order of unapplied patches too while we're at it.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t2000-sync.sh | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/t/t2000-sync.sh b/t/t2000-sync.sh
index 02345bb..69ab1ac 100755
--- a/t/t2000-sync.sh
+++ b/t/t2000-sync.sh
@@ -29,7 +29,9 @@ test_expect_success \
stg add foo3.txt &&
stg refresh &&
stg export &&
- stg pop
+ stg pop &&
+ [ "$(echo $(stg applied))" = "p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "p3" ]
'
test_expect_success \
@@ -38,15 +40,17 @@ test_expect_success \
stg branch -c foo base &&
stg new p1 -m p1 &&
stg new p2 -m p2 &&
- stg new p3 -m p3
- test $(stg applied -c) -eq 3
+ stg new p3 -m p3 &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ]
'
test_expect_success \
'Synchronise second patch with the master branch' \
'
stg sync -b master p2 &&
- test $(stg applied -c) -eq 3 &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ] &&
test $(cat foo2.txt) = "foo2"
'
@@ -54,7 +58,8 @@ test_expect_success \
'Synchronise the first two patches with the master branch' \
'
stg sync -b master -a &&
- test $(stg applied -c) -eq 3 &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ] &&
test $(cat foo1.txt) = "foo1" &&
test $(cat foo2.txt) = "foo2"
'
@@ -63,7 +68,8 @@ test_expect_success \
'Synchronise all the patches with the exported series' \
'
stg sync -s patches-master/series -a &&
- test $(stg applied -c) -eq 3 &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ] &&
test $(cat foo1.txt) = "foo1" &&
test $(cat foo2.txt) = "foo2" &&
test $(cat foo3.txt) = "foo3"
@@ -73,6 +79,8 @@ test_expect_success \
'Modify the master patches' \
'
stg branch master &&
+ [ "$(echo $(stg applied))" = "p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "p3" ] &&
stg goto p1 &&
echo bar1 >> foo1.txt &&
stg refresh &&
@@ -83,6 +91,8 @@ test_expect_success \
stg goto p3 &&
echo bar3 >> foo3.txt &&
stg refresh &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ] &&
stg export &&
stg branch foo
'
@@ -91,7 +101,8 @@ test_expect_success \
'Synchronise second patch with the master branch' \
'
stg sync -b master p2 &&
- test $(stg applied -c) -eq 3 &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ] &&
test $(cat bar2.txt) = "bar2"
'
@@ -104,10 +115,13 @@ test_expect_failure \
test_expect_success \
'Restore the stack status after the failed sync' \
'
- test $(stg applied -c) -eq 1 &&
+ [ "$(echo $(stg applied))" = "p1" ] &&
+ [ "$(echo $(stg unapplied))" = "p2 p3" ] &&
stg resolved -a &&
stg refresh &&
stg goto p3
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ]
'
test_expect_failure \
@@ -119,9 +133,12 @@ test_expect_failure \
test_expect_success \
'Restore the stack status after the failed sync' \
'
- test $(stg applied -c) -eq 3 &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ] &&
stg resolved -a &&
- stg refresh
+ stg refresh &&
+ [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "" ]
'
test_done
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [StGIT PATCH 3/3] Use "stg applied" instead of reading the applied file directly
2007-05-13 18:27 [StGIT PATCH 1/3] Make patch deletion test more specific Karl Hasselström
2007-05-13 18:27 ` [StGIT PATCH 2/3] Test patch order, not just number of patches Karl Hasselström
@ 2007-05-13 18:27 ` Karl Hasselström
1 sibling, 0 replies; 3+ messages in thread
From: Karl Hasselström @ 2007-05-13 18:27 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
From: Karl Hasselström <kha@treskal.com>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t1500-float.sh | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/t/t1500-float.sh b/t/t1500-float.sh
index dbcd8ce..814c9bd 100755
--- a/t/t1500-float.sh
+++ b/t/t1500-float.sh
@@ -20,37 +20,37 @@ test_expect_success \
stg new F -m "f" && echo F >f.txt && stg add f.txt && stg refresh &&
stg new G -m "g" && echo G >g.txt && stg add g.txt && stg refresh &&
stg pop &&
- test "`echo \`cat .git/patches/master/applied\``" = "A B C D E F"
+ test "$(echo $(stg applied))" = "A B C D E F"
'
test_expect_success \
'Float A to top' \
'stg float A &&
- test "`echo \`cat .git/patches/master/applied\``" = "B C D E F A"
+ test "$(echo $(stg applied))" = "B C D E F A"
'
test_expect_success \
'Float A to top (noop)' \
'stg float A &&
- test "`echo \`cat .git/patches/master/applied\``" = "B C D E F A"
+ test "$(echo $(stg applied))" = "B C D E F A"
'
test_expect_success \
'Float B C to top' \
'stg float B C &&
- test "`echo \`cat .git/patches/master/applied\``" = "D E F A B C"
+ test "$(echo $(stg applied))" = "D E F A B C"
'
test_expect_success \
'Float E A to top' \
'stg float E A &&
- test "`echo \`cat .git/patches/master/applied\``" = "D F B C E A"
+ test "$(echo $(stg applied))" = "D F B C E A"
'
test_expect_success \
'Float E to top' \
'stg float E &&
- test "`echo \`cat .git/patches/master/applied\``" = "D F B C A E"
+ test "$(echo $(stg applied))" = "D F B C A E"
'
test_expect_success \
'Float G F to top' \
'stg float G F &&
- test "`echo \`cat .git/patches/master/applied\``" = "D B C A E G F"
+ test "$(echo $(stg applied))" = "D B C A E G F"
'
test_done
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-13 18:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-13 18:27 [StGIT PATCH 1/3] Make patch deletion test more specific Karl Hasselström
2007-05-13 18:27 ` [StGIT PATCH 2/3] Test patch order, not just number of patches Karl Hasselström
2007-05-13 18:27 ` [StGIT PATCH 3/3] Use "stg applied" instead of reading the applied file directly Karl Hasselström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).