[PATCH 1/3] test: add known broken tests for from: and subject:

Tomi Ollila tomi.ollila at iki.fi
Sun Aug 25 02:33:17 PDT 2019


On Wed, Aug 21 2019, David Bremner wrote:

> Given we want 'a b' to parse as 'a AND b', then for any
> probabilistic (free text) prefix foo:, we should also get 'foo:a
> foo:b' expanding to 'foo:a AND foo:b'. Currently this is not true due
> to the implimentation of regex fields.

implementation =D

> ---
>  test/T760-implicit-operators.sh | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>  create mode 100755 test/T760-implicit-operators.sh
>
> diff --git a/test/T760-implicit-operators.sh b/test/T760-implicit-operators.sh
> new file mode 100755
> index 00000000..b79673df
> --- /dev/null
> +++ b/test/T760-implicit-operators.sh
> @@ -0,0 +1,28 @@
> +#!/usr/bin/env bash
> +test_description='implicit operators in query parser'
> +. $(dirname "$0")/test-lib.sh || exit 1
> +
> +test_AND() {
> +    add_message  "[$1]=a at b"
> +    add_message  "[$1]=b at c"
> +
> +    test_begin_subtest "$1: implicitly joined by AND"
> +    $2
> +    notmuch count $1:a at b > OUTPUT
> +    notmuch count $1:a $1:b >> OUTPUT
> +    notmuch count $1:a at b OR $1:b at c >> OUTPUT
> +    notmuch count $1:a at b $1:b at c >> OUTPUT
> +    cat <<EOF > EXPECTED
> +1
> +1
> +2
> +0
> +EOF

the above could be done  printf %s\\n  1  1  2  0  > EXPECTED

(whichever way is "clearer" -- using '%s\n' or even "%s\n" is 
also possible (just increasingly harder to write ;D))

Tomi

> +    test_expect_equal_file EXPECTED OUTPUT
> +}
> +
> +test_AND from test_subtest_known_broken
> +test_AND subject test_subtest_known_broken
> +test_AND to
> +
> +test_done
> -- 
> 2.23.0.rc1


More information about the notmuch mailing list