From: Phillip Wood <phillip.wood123@gmail.com>
To: Emily Shaffer <emilyshaffer@google.com>, git@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/4] t1510-repo-setup: don't use exact matching on traces
Date: Fri, 23 Apr 2021 10:59:12 +0100 [thread overview]
Message-ID: <c31c30f0-2613-0a12-1025-6043ef5f2962@gmail.com> (raw)
In-Reply-To: <20210423001539.4059524-3-emilyshaffer@google.com>
Hi Emily
On 23/04/2021 01:15, Emily Shaffer wrote:
> Tests which interrogate the exact underlying behavior of the code under
> test, instead of checking for the presence of desired side effects or
> calls, are a known testing antipattern. They are flaky as they need to
> be updated every time the underlying implementation changes.
>
> By using 'grep --fixed-strings --file <expect>' instead, we can check
> for the positive presence of lines we are sure should be happening, and
> ignore any additional things which may be happening around us (for
> example, additional child processes which are occurring unrelated to the
> code under test).
>
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---
> t/t1510-repo-setup.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
> index bbfe05b8e4..8bd4f54d03 100755
> --- a/t/t1510-repo-setup.sh
> +++ b/t/t1510-repo-setup.sh
> @@ -63,7 +63,7 @@ test_repo () {
> rm -f trace &&
> GIT_TRACE_SETUP="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
> grep '^setup: ' trace >result &&
> - test_cmp expected result
> + grep -Ff expected result
If there is more than one line in expected (it's not clear from the
limited context if there is) then grep will succeed if any of the lines
match rather than requiring all the lines to match as test_cmp does.
Best wishes
Phillip
> )
> }
>
>
next prev parent reply other threads:[~2021-04-23 9:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 23:39 [RFC PATCH 0/2] share a config between submodule and superproject Emily Shaffer
2021-04-08 23:39 ` [RFC PATCH 1/2] config: rename "submodule" scope to "gitmodules" Emily Shaffer
2021-04-08 23:39 ` [RFC PATCH 2/2] config: add 'config.superproject' file Emily Shaffer
2021-04-09 11:10 ` Philip Oakley
2021-04-13 18:05 ` Emily Shaffer
2021-04-09 14:35 ` Matheus Tavares Bernardino
2021-04-09 22:29 ` Junio C Hamano
2021-04-13 19:45 ` Emily Shaffer
2021-04-13 18:48 ` Emily Shaffer
2021-04-14 10:32 ` Future structure of submodules and .git/, .git/modules/* organization Ævar Arnfjörð Bjarmason
2021-04-15 21:25 ` Emily Shaffer
2021-04-15 21:41 ` Junio C Hamano
2021-04-23 0:15 ` [RFC PATCH v2 0/4] share a config between submodule and superproject Emily Shaffer
2021-04-23 0:15 ` [RFC PATCH v2 1/4] config: rename "submodule" scope to "gitmodules" Emily Shaffer
2021-04-23 9:46 ` Phillip Wood
2021-04-23 0:15 ` [RFC PATCH v2 2/4] t1510-repo-setup: don't use exact matching on traces Emily Shaffer
2021-04-23 9:59 ` Phillip Wood [this message]
2021-04-23 0:15 ` [RFC PATCH v2 3/4] t7006-pager.sh: more lenient trace checking Emily Shaffer
2021-04-23 9:54 ` Phillip Wood
2021-04-23 12:45 ` Phillip Wood
2021-04-23 0:15 ` [RFC PATCH v2 4/4] config: add 'config.superproject' file Emily Shaffer
2021-04-23 12:08 ` Johannes Schindelin
2021-06-19 0:31 ` [PATCH v3 0/2] share a config between submodule and superproject Emily Shaffer
2021-06-19 0:31 ` [PATCH v3 1/2] config: rename "submodule" scope to "gitmodules" Emily Shaffer
2021-06-19 0:31 ` [PATCH v3 2/2] config: add 'config.superproject' file Emily Shaffer
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=c31c30f0-2613-0a12-1025-6043ef5f2962@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=emilyshaffer@google.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.
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).