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

[PATCH 1/4] t/t3905: use the name 'actual' for test output, swap arguments to test_cmp

From
Brandon Casey <drafnel@gmail.com>
Date
Aug 27, 2011, 00:59 UTC
Message-ID
<1314406767-17832-1-git-send-email-drafnel@gmail.com>

It is common practice in the git test suite to use the file names 'actual' and 'expect' to hold the actual and expected output of commands. So change the name 'output' to 'actual'.

Additionally, swap the order of arguments to test_cmp when comparing expected output and actual output so that if diff output is produced, it describes how the actual output differs from what was expected rather than the other way around.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 t/t3905-stash-include-untracked.sh |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index 4f2eedf..adc2524 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -23,13 +23,13 @@ test_expect_success 'stash save --include-untracked some dirty working directory
 '
 
 cat > expect <<EOF
+?? actual
 ?? expect
-?? output
 EOF
 
 test_expect_success 'stash save --include-untracked cleaned the untracked files' '
-	git status --porcelain > output
-	test_cmp output expect
+	git status --porcelain >actual
+	test_cmp expect actual
 '
 
 cat > expect.diff <<EOF
@@ -47,10 +47,10 @@ EOF
 
 test_expect_success 'stash save --include-untracked stashed the untracked files' '
 	test "!" -f file2 &&
-	git diff HEAD..stash^3 -- file2 > output &&
-	test_cmp output expect.diff &&
-	git ls-tree --name-only stash^3: > output &&
-	test_cmp output expect.lstree
+	git diff HEAD..stash^3 -- file2 >actual &&
+	test_cmp expect.diff actual &&
+	git ls-tree --name-only stash^3: >actual &&
+	test_cmp expect.lstree actual
 '
 test_expect_success 'stash save --patch --include-untracked fails' '
 	test_must_fail git stash --patch --include-untracked
@@ -64,15 +64,15 @@ git clean --force --quiet
 
 cat > expect <<EOF
  M file
+?? actual
 ?? expect
 ?? file2
-?? output
 EOF
 
 test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
 	git stash pop &&
-	git status --porcelain > output
-	test_cmp output expect
+	git status --porcelain >actual
+	test_cmp expect actual
 '
 
 git clean --force --quiet
@@ -96,8 +96,8 @@ EOF
 
 test_expect_success 'stash save --include-untracked dirty index got stashed' '
 	git stash pop --index &&
-	git diff --cached > output &&
-	test_cmp output expect
+	git diff --cached >actual &&
+	test_cmp expect actual
 '
 
 git reset > /dev/null
-- 
1.7.6
Next: Brandon Casey
Message 1 of 6 in “t/t3905: use the name 'actual' for test output, swap arguments to test_cmp”
  1. 1/4 t/t3905: use the name 'actual' for test output, swap arguments to test_cmpBrandon Casey, Aug 27, 2011
  2. 2/4 git-stash.sh: fix typo in error messageBrandon Casey, Aug 27, 2011
  3. 3/4 t/t3905: add missing '&&' linkageBrandon Casey, Aug 27, 2011
  4. 4/4 git-stash: remove untracked/ignored directories when stashedBrandon Casey, Aug 27, 2011
  5. Hilco WijbengaAug 27, 2011
  6. Junio C HamanoAug 27, 2011

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.