git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGit PATCH] Test "stg status" more thoroughly
@ 2007-09-03  0:00 Karl Hasselström
  0 siblings, 0 replies; only message in thread
From: Karl Hasselström @ 2007-09-03  0:00 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 t/t0002-status.sh |  114 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 112 insertions(+), 2 deletions(-)


diff --git a/t/t0002-status.sh b/t/t0002-status.sh
index c088d56..ce3b688 100755
--- a/t/t0002-status.sh
+++ b/t/t0002-status.sh
@@ -8,8 +8,118 @@ test_description='Basic stg status
 Test that "stg status" works.'
 
 . ./test-lib.sh
+stg init
 
-test_expect_success 'Run status on empty' \
-  'stg status'
+# Ignore our own output files.
+cat > .git/info/exclude <<EOF
+/expected.txt
+/output.txt
+EOF
+
+cat > expected.txt <<EOF
+EOF
+test_expect_success 'Run status on empty' '
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+? foo
+EOF
+test_expect_success 'Status with an untracked file' '
+    touch foo &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+rm -f foo
+
+cat > expected.txt <<EOF
+EOF
+test_expect_success 'Status with an empty directory' '
+    mkdir foo &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+? foo/
+EOF
+test_expect_success 'Status with an untracked file in a subdir' '
+    touch foo/bar &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+A foo/bar
+EOF
+test_expect_success 'Status with an added file' '
+    stg add foo &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+EOF
+test_expect_success 'Status after refresh' '
+    stg new -m "first patch" &&
+    stg refresh &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+M foo/bar
+EOF
+test_expect_success 'Status after modification' '
+    echo "wee" >> foo/bar &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+EOF
+test_expect_success 'Status after refresh' '
+    stg new -m "second patch" && stg refresh &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+test_expect_success 'Make a conflicting patch' '
+    stg pop &&
+    stg new -m "third patch" &&
+    echo "woo" >> foo/bar &&
+    stg refresh
+'
+
+cat > expected.txt <<EOF
+? foo/bar.ancestor
+? foo/bar.current
+? foo/bar.patched
+C foo/bar
+EOF
+test_expect_success 'Status after conflicting push' '
+    ! stg push &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+M foo/bar
+EOF
+test_expect_success 'Status after resolving the push' '
+    stg resolved -a &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
+
+cat > expected.txt <<EOF
+D foo/bar
+EOF
+test_expect_success 'Status after deleting a file' '
+    rm foo/bar &&
+    stg status > output.txt &&
+    diff -u expected.txt output.txt
+'
 
 test_done

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-03  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-03  0:00 [StGit PATCH] Test "stg status" more thoroughly 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).