Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures because of localized error messages #2

Closed
eserte opened this issue Feb 4, 2020 · 5 comments
Closed

Test failures because of localized error messages #2

eserte opened this issue Feb 4, 2020 · 5 comments

Comments

@eserte
Copy link

@eserte eserte commented Feb 4, 2020

On some systems (i.e. perl <= 5.20 and non-English locale) the test suite fails:

...
    #   Failed test 'good error'
    #   at t/errors.t line 299.
    #          got: 'bad_file_write: file read/write failure [Can't open '/cant/possibly/exist' for writing: 'Datei oder Verzeichnis nicht gefunden']
    # '
    #     expected: 'bad_file_write: file read/write failure [Can't open '/cant/possibly/exist' for writing: 'No such file or directory']
    # '
    # Looks like you failed 1 test of 2.

#   Failed test 'catches failures in file ops'
#   at t/errors.t line 299.
# Looks like you failed 1 test of 22.
t/errors.t ..... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/22 subtests 
t/export.t ..... ok

    #   Failed test 'good error pattern'
    #   at t/flow-guts.t line 91.
    #                   'Can't open($fh, '/this/file/cannot/possibly/exist'): Datei oder Verzeichnis nicht gefunden at /var/tmp/cpansmoker-1023/2020020405/MascgC5qVO/test_autodie line 3
    # '
    #     doesn't match '(?^:No such file or directory)'
    # Looks like you failed 1 test of 2.

#   Failed test 'autodie is turned on'
#   at t/flow-guts.t line 91.
# Looks like you failed 1 test of 8.
t/flow-guts.t .. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/8 subtests 
...
@barefootcoder

This comment has been minimized.

Copy link
Owner

@barefootcoder barefootcoder commented Feb 5, 2020

Shit. :-/ Yeah, I caught the exit value being different fairly quickly, but I forgot about the language issue. So, I believe I'm working around a similar issue in Date::Easy via forcing C locale ... do you think that's the best solution here as well? or should I just make much more liberal regexen? If you have an opinion, I'd certainly love to hear your thoughts. :-)

barefootcoder added a commit that referenced this issue Feb 5, 2020
I can't actually reproduce the problem, even by fiddling with the locale
-	but I'm optimistic this will fix it anyway
-	as the general tactic has been successful for PerlX::bash, which is very similar
@barefootcoder

This comment has been minimized.

Copy link
Owner

@barefootcoder barefootcoder commented Feb 5, 2020

Sorry; it wasn't Date::Easy where I had done this, but rather PerlX::bash. Which is even closer to this than the date stuff, so I'm hopeful that this will fix it, although I didn't have any luck reproducing the error on my system. But we shall see, I suppose. :-)

@eserte

This comment has been minimized.

Copy link
Author

@eserte eserte commented Feb 6, 2020

A possible solution is to get the localized error messages, and use them in the tests. I do this in my Doit testsuite, see

@barefootcoder

This comment has been minimized.

Copy link
Owner

@barefootcoder barefootcoder commented Feb 6, 2020

A possible solution is to get the localized error messages, and use them in the tests.

Yeah, that's a good call, and a handy technique. I will totally try that out.

barefootcoder added a commit that referenced this issue Feb 8, 2020
as per GitHub #2
this gets the actual error message from the system,
-	so therefore I don't have to worry about hardcoding error messages
I'm also reverting my previous, hackier fix,
-	since it should no longer be necessary
@barefootcoder

This comment has been minimized.

Copy link
Owner

@barefootcoder barefootcoder commented Feb 9, 2020

Okay, I think this is all fixed as well. I'm closing it out; reopen if you see any more similar issues.

Hopefully 0.02 is coming in the next couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.