[PATCH 2 of 5] tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages

Yuya Nishihara yuya at tcha.org
Sun Dec 3 03:59:37 EST 2017


On Sun, 03 Dec 2017 01:54:55 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1512261214 18000
> #      Sat Dec 02 19:33:34 2017 -0500
> # Node ID 8e58a105a6fc156673e852ec9a40f2d517fc7ceb
> # Parent  c65000767eec5a1a159c73cd2fe7b6741a1dea84
> tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages

> +# Various platform error strings, keyed on a common replacement string
> +_errors = {
> +    br'$ENOENT$': (
> +        # strerror()
> +        br'No such file or directory',
> +
> +        # FormatMessage(ERROR_FILE_NOT_FOUND)
> +        br'The system cannot find the file specified',
> +    ),
> +}
> +
> +for replace, msgs in _errors.items():
> +    substitutions.extend((m, replace) for m in msgs)
> diff --git a/tests/test-acl.t b/tests/test-acl.t
> --- a/tests/test-acl.t
> +++ b/tests/test-acl.t
> @@ -925,7 +925,7 @@
>    bundle2-input-bundle: 4 parts total
>    transaction abort!
>    rollback completed
> -  abort: No such file or directory: ../acl.config
> +  abort: $ENOENT$: ../acl.config

IIRC, this sort of messages are locale dependent on Windows, and we can't
easily switch the Windows locale.

Foozy, can you test if this series works for you?


More information about the Mercurial-devel mailing list