On Wed, Sep 19, 2012 at 03:37:08PM -0400, Jeff King wrote:
> Looking at it again, it is actually quite subtle what is going on. We
> wrap the outer test_expect_* calls in double-quotes so that the inner
> ones can use single-quotes easily. But that means that technically the
> contents of the here-doc _are_ interpolated. But not at test run-time,
> but rather at the call to test_expect_*. And that is why we nee to use
> "\\" instead of "\". So I think anybody trying to tweak these tests
> using shell metacharacters is in for a surprise either way.

Actually I already did that in one place:

    test_expect_success 'pretend we have a fully passing test suite' "
            run_sub_test_lib_test full-pass '3 passing tests' <<-\\EOF &&
            for i in 1 2 3; do
                    test_expect_success \"passing test #\$i\" 'true'
            done
            test_done
            EOF
    [...]
    "

Without the \\ preceeding the EOF, it needed to be:

                    test_expect_success \"passing test #\\\$i\" 'true'

> I'm not sure it is worth worrying about, though, as handling it
> would probably make the existing tests less readable.

Yeah, the for loop is perhaps slightly overkill :-)

> It all looks sane to me. Thanks again.

Thanks for your (unnervingly) thorough reviews ;-)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to