Fix the import --url command
[stgit] / t / t1601-delete-many.sh
index 8648ed1..cb7fb0d 100755 (executable)
@@ -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 add foo.txt &&
+    stg new p0 -m p0 &&
+    echo p0 > foo.txt &&
+    git 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 series --applied --noprefix))" = "p0 p1 p2 p3 p4" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p6 p7 p8 p9" ] &&
+    stg delete p7 p6 p3 p4 &&
+    [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "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 series --applied --noprefix))" = "p0 p1 p2" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ] &&
+    command_error stg delete p7 p8 p2 p0 &&
+    [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "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 series --applied --noprefix))" = "p0 p1 p2" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ] &&
+    stg delete p1..p8 &&
+    [ "$(echo $(stg series --applied --noprefix))" = "p0" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "p9" ]
     '
 
 test_done