git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH] Test "stg status" more thoroughly
Date: Mon, 03 Sep 2007 02:00:00 +0200	[thread overview]
Message-ID: <20070902235947.23866.81320.stgit@yoghurt> (raw)

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

                 reply	other threads:[~2007-09-03  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070902235947.23866.81320.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).