chiark / gitweb /
Test that "stg goto" can be called from a subdirectory
authorKarl Hasselström <kha@treskal.com>
Wed, 19 Dec 2007 20:51:21 +0000 (21:51 +0100)
committerKarl Hasselström <kha@treskal.com>
Wed, 9 Jan 2008 23:37:14 +0000 (00:37 +0100)
It currently can't; therefore, the tests are marked as known failures.

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

diff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh
new file mode 100755 (executable)
index 0000000..9f3ab26
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+test_description='Run "stg goto" in a subdirectory'
+
+. ./test-lib.sh
+
+test_expect_success 'Initialize StGit stack' '
+    stg init &&
+    echo expected1.txt >> .git/info/exclude &&
+    echo expected2.txt >> .git/info/exclude &&
+    echo actual.txt >> .git/info/exclude &&
+    mkdir foo &&
+    for i in 1 2 3; do
+        echo foo$i >> foo/bar &&
+        stg new p$i -m p$i &&
+        git add foo/bar &&
+        stg refresh
+    done
+'
+
+cat > expected1.txt <<EOF
+foo1
+EOF
+cat > expected2.txt <<EOF
+bar
+EOF
+test_expect_failure 'Goto in subdirectory (just pop)' '
+    (cd foo && stg goto p1) &&
+    cat foo/bar > actual.txt &&
+    diff -u expected1.txt actual.txt &&
+    ls foo > actual.txt &&
+    diff -u expected2.txt actual.txt
+'
+
+test_expect_success 'Prepare conflicting goto' '
+    stg delete p2
+'
+
+cat > expected1.txt <<EOF
+foo1
+<<<<<<< current:foo/bar
+=======
+foo2
+foo3
+>>>>>>> patched:foo/bar
+EOF
+cat > expected2.txt <<EOF
+bar
+EOF
+test_expect_failure 'Goto in subdirectory (conflicting push)' '
+    (cd foo && stg goto p3) ;
+    [ $? -eq 3 ] &&
+    cat foo/bar > actual.txt &&
+    diff -u expected1.txt actual.txt &&
+    ls foo > actual.txt &&
+    diff -u expected2.txt actual.txt
+'
+
+test_done