chiark / gitweb /
New test: make sure that popping doesn't change patch order
authorKarl Hasselström <kha@treskal.com>
Mon, 20 Aug 2007 21:36:00 +0000 (22:36 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Mon, 20 Aug 2007 21:36:33 +0000 (22:36 +0100)
This is mostly useful in conjunction with the DAG appliedness patches,
since getting this right with a plain series file _ought_ to be
trivial. Nevertheless ...

Signed-off-by: Karl Hasselström <kha@treskal.com>
t/t1203-pop.sh [new file with mode: 0755]

diff --git a/t/t1203-pop.sh b/t/t1203-pop.sh
new file mode 100755 (executable)
index 0000000..6e49b4d
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Copyright (c) 2007 Karl Hasselström
+test_description='Test the pop command'
+. ./test-lib.sh
+
+test_expect_success \
+    'Initialize the StGIT repository' \
+    'stg init'
+
+test_expect_success \
+    'Create ten patches' '
+    for i in 0 1 2 3 4 5 6 7 8 9; do
+        stg new p$i -m p$i;
+    done &&
+    [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ] &&
+    [ "$(echo $(stg unapplied))" = "" ]
+'
+
+test_expect_success \
+    'Pop half the patches' '
+    stg pop -n 5 &&
+    [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
+    [ "$(echo $(stg unapplied))" = "p5 p6 p7 p8 p9" ]
+'
+
+test_expect_success \
+    'Pop the remaining patches' '
+    stg pop -a &&
+    [ "$(echo $(stg applied))" = "" ] &&
+    [ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ]
+'
+
+test_done