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>
Cc: Joel Teichroeb <joel@teichroeb.net>
Subject: [PATCH v3 1/5] stash: improve option parsing test coverage
Date: Mon, 26 Mar 2018 22:44:28 -0700 [thread overview]
Message-ID: <20180327054432.26419-2-joel@teichroeb.net> (raw)
In-Reply-To: <20180327054432.26419-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-27 5:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 5:44 [PATCH v3 0/5] Convert some stash functionality to a builtin Joel Teichroeb
2018-03-27 5:44 ` Joel Teichroeb [this message]
2018-03-27 5:44 ` [PATCH v3 2/5] stash: convert apply to builtin Joel Teichroeb
2018-03-27 15:07 ` Johannes Schindelin
2018-03-27 16:02 ` Johannes Schindelin
2018-03-27 16:20 ` Joel Teichroeb
2018-03-27 5:44 ` [PATCH v3 3/5] stash: convert drop and clear " Joel Teichroeb
2018-03-27 5:44 ` [PATCH v3 4/5] stash: convert branch " Joel Teichroeb
2018-03-27 5:44 ` [PATCH v3 5/5] stash: convert pop " Joel Teichroeb
2018-03-27 14:47 ` [PATCH v3 0/5] Convert some stash functionality to a builtin Johannes Schindelin
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=20180327054432.26419-2-joel@teichroeb.net \
--to=joel@teichroeb.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--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).