From: Joel Teichroeb <joel@teichroeb.net>
To: Git Mailing List <git@vger.kernel.org>,
Thomas Gummerer <t.gummerer@gmail.com>,
Christian Couder <christian.couder@gmail.com>,
Eric Sunshine <sunshine@sunshineco.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
gitster@pobox.com
Cc: Joel Teichroeb <joel@teichroeb.net>
Subject: [PATCH v4 1/5] stash: improve option parsing test coverage
Date: Wed, 28 Mar 2018 15:21:25 -0700 [thread overview]
Message-ID: <20180328222129.22192-2-joel@teichroeb.net> (raw)
In-Reply-To: <20180328222129.22192-1-joel@teichroeb.net>
In preparation for converting the stash command incrementally to
a builtin command, this patch improves test coverage of the option
parsing. Both for having too many paramerters, or too few.
Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
---
t/t3903-stash.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index aefde7b17..8a666c60c 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -84,6 +84,17 @@ test_expect_success 'apply stashed changes (including index)' '
test 1 = $(git show HEAD:file)
'
+test_expect_success 'giving too many ref agruments does nothing' '
+
+ for type in apply drop pop show "branch stash-branch"
+ do
+ test-chmtime =123456789 file &&
+ test_must_fail git stash $type stash@{0} stash@{1} 2>err &&
+ test_i18ngrep "Too many" err &&
+ test 123456789 = $(test-chmtime -v +0 file | sed 's/[^0-9].*$//') || return 1
+ done
+'
+
test_expect_success 'unstashing in a subdirectory' '
git reset --hard HEAD &&
mkdir subdir &&
@@ -479,6 +490,11 @@ test_expect_success 'stash branch - stashes on stack, stash-like argument' '
test $(git ls-files --modified | wc -l) -eq 1
'
+test_expect_success 'stash branch complains with no arguments' '
+ test_must_fail git stash branch 2>err &&
+ test_i18ngrep "No branch name specified" err
+'
+
test_expect_success 'stash show format defaults to --stat' '
git stash clear &&
test_when_finished "git reset --hard HEAD" &&
--
2.16.2
next prev parent reply other threads:[~2018-03-28 22:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-28 22:21 [PATCH v4 0/5] Convert some stash functionality to a builtin Joel Teichroeb
2018-03-28 22:21 ` Joel Teichroeb [this message]
2018-03-29 10:10 ` [PATCH v4 1/5] stash: improve option parsing test coverage Eric Sunshine
2018-03-29 19:39 ` Junio C Hamano
2018-03-28 22:21 ` [PATCH v4 2/5] stash: convert apply to builtin Joel Teichroeb
2018-03-29 20:07 ` Junio C Hamano
2018-03-31 17:04 ` Joel Teichroeb
2018-03-28 22:21 ` [PATCH v4 3/5] stash: convert drop and clear " Joel Teichroeb
2018-03-30 16:17 ` Junio C Hamano
2018-03-28 22:21 ` [PATCH v4 4/5] stash: convert branch " Joel Teichroeb
2018-03-28 22:21 ` [PATCH v4 5/5] stash: convert pop " Joel Teichroeb
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180328222129.22192-2-joel@teichroeb.net \
--to=joel@teichroeb.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.com \
--cc=t.gummerer@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).