From: Joshua Nelson <jyn514@gmail.com>
To: git@vger.kernel.org
Cc: Joshua Nelson <jyn514@gmail.com>
Subject: [PATCH 3/3] ls-tree: add unit tests for arguments
Date: Mon, 2 Jul 2018 23:58:02 -0400 [thread overview]
Message-ID: <20180703035802.24060-3-jyn514@gmail.com> (raw)
In-Reply-To: <20180703035802.24060-1-jyn514@gmail.com>
Signed-off-by: Joshua Nelson <jyn514@gmail.com>
---
t/t3104-ls-tree-optional-args.sh | 43 ++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 t/t3104-ls-tree-optional-args.sh
diff --git t/t3104-ls-tree-optional-args.sh t/t3104-ls-tree-optional-args.sh
new file mode 100644
index 000000000..5917563a7
--- /dev/null
+++ t/t3104-ls-tree-optional-args.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+test_description='ls-tree test (optional args)
+
+This test tries to run git-ls-tree with various combinations of options.'
+
+. ./test-lib.sh
+
+test_expect_success 'initial setup' '
+echo hi > test && cp test test2 && git add test test2 && git commit -m initial'
+
+# cat appends newlines after every file
+test_expect_success 'succeed when given no args' 'git ls-tree'
+
+test_expect_success 'succeed when given only --' 'git ls-tree'
+
+test_expect_success 'add second commit' '
+echo hi > test3 && git add test3 && git commit -m "commit 2"'
+
+test_expect_success 'succeed when given revision' '
+git ls-tree HEAD~1'
+
+test_expect_success 'succeed when given revision and --' '
+git ls-tree HEAD~1 --'
+
+test_expect_success 'succeed when given -- and file' '
+git ls-tree -- test3'
+
+test_expect_success 'do nothing when given bad files' '
+git ls-tree -- bad_files'
+
+test_expect_success 'succeed when given file from past revision' '
+git ls-tree HEAD~1 test'
+
+test_expect_success 'succeed when given only file' 'git ls-tree test'
+
+test_expect_success 'raise error when given bad args' '
+test_must_fail git ls-tree HEAD HEAD --'
+
+test_expect_success 'raise error when given bad revision' '
+test_must_fail git ls-tree bad_revision --'
+
+test_done
--
2.18.GIT
next prev parent reply other threads:[~2018-07-03 3:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 3:58 [PATCH 1/3] ls-tree: make <tree-ish> optional Joshua Nelson
2018-07-03 3:58 ` [PATCH 2/3] ls-tree: update usage info Joshua Nelson
2018-07-03 7:14 ` Elijah Newren
2018-07-03 7:18 ` Eric Sunshine
2018-07-03 3:58 ` Joshua Nelson [this message]
2018-07-03 7:30 ` [PATCH 3/3] ls-tree: add unit tests for arguments Elijah Newren
2018-07-03 7:33 ` Eric Sunshine
2018-07-03 7:12 ` [PATCH 1/3] ls-tree: make <tree-ish> optional Elijah Newren
2018-07-03 22:05 ` Junio C Hamano
2018-07-03 22:55 ` Elijah Newren
2018-07-03 22:58 ` Joshua Nelson
2018-07-06 17:01 ` Junio C Hamano
2018-07-06 21:26 ` Joshua Nelson
2018-07-06 21:32 ` Junio C Hamano
2018-07-03 7:15 ` Eric Sunshine
2018-07-03 23:15 ` Joshua Nelson
2018-07-03 23:53 ` [PATCH] " Joshua Nelson
2018-07-04 0:05 ` Joshua Nelson
2018-07-04 9:38 ` Eric Sunshine
2018-07-04 10:04 ` Eric Sunshine
2018-07-04 9:29 ` [PATCH 1/3] " Eric Sunshine
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=20180703035802.24060-3-jyn514@gmail.com \
--to=jyn514@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).