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

Fix failing tests with some versions of libmagic #5

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@choroba
Contributor

choroba commented Jun 30, 2015

On my Linux box (openSUSE 13.1, MAGIC_VERSION 515), the tests were failing in the same way as on OpenBSD at CPANTesters: for PDFs, the library returned unknown charset rather than binary. This fix changes the tests to accept both possibilities.

@@ -13,17 +13,17 @@ use File::LibMagic;
'foo.foo' => [
'ASCII text',
'text/plain',
'us-ascii',
qr/us-ascii/,

This comment has been minimized.

@autarch

autarch Jun 30, 2015

Collaborator

What is this change addressing?

@autarch

autarch Jun 30, 2015

Collaborator

What is this change addressing?

This comment has been minimized.

@choroba

choroba Jun 30, 2015

Contributor

I just wanted to be consistent. Encoding is now a regex always.

@choroba

choroba Jun 30, 2015

Contributor

I just wanted to be consistent. Encoding is now a regex always.

$info->{mime_with_encoding},
"$mime; charset=$encoding",
qr/^$mime; charset=(?:$encoding)$/,

This comment has been minimized.

@autarch

autarch Jun 30, 2015

Collaborator

The parens here aren't doing anything, and turning this into a regex doesn't seem to change the test at all, from my reading. The regex as written would be identical to comparing two strings, unless the interpolated variables contain regex metacharacters. Am I missing something?

@autarch

autarch Jun 30, 2015

Collaborator

The parens here aren't doing anything, and turning this into a regex doesn't seem to change the test at all, from my reading. The regex as written would be identical to comparing two strings, unless the interpolated variables contain regex metacharacters. Am I missing something?

This comment has been minimized.

@choroba

choroba Jun 30, 2015

Contributor

For the qr/binary|unknown/ (line 26), it makes the tests pass on my machine.

@choroba

choroba Jun 30, 2015

Contributor

For the qr/binary|unknown/ (line 26), it makes the tests pass on my machine.

@choroba

This comment has been minimized.

Show comment
Hide comment
@choroba

choroba Jul 12, 2015

Contributor

I blogged about the changes.

Contributor

choroba commented Jul 12, 2015

I blogged about the changes.

@autarch

This comment has been minimized.

Show comment
Hide comment
@autarch

autarch Jul 12, 2015

Collaborator

I didn't realize you were waiting for me. I merged this from the CLI. Thanks!

Collaborator

autarch commented Jul 12, 2015

I didn't realize you were waiting for me. I merged this from the CLI. Thanks!

@autarch autarch closed this Jul 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment