git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGit PATCH] Test "stg status" more thoroughly

From
Karl Hasselström <kha@treskal.com>
Date
Sep 3, 2007, 00:00 UTC
Message-ID
<20070902235947.23866.81320.stgit@yoghurt>
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
Message 1 of 1 in “Test "stg status" more thoroughly”
  1. Test "stg status" more thoroughlyKarl Hasselström, Sep 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.