Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

~optimize Perl::Koans::determine_test_count() #6

Open
chorankates-sfdc opened this issue Aug 1, 2012 · 2 comments
Open

~optimize Perl::Koans::determine_test_count() #6

chorankates-sfdc opened this issue Aug 1, 2012 · 2 comments

Comments

@chorankates-sfdc
Copy link
Contributor

two problems:

  • it doesn't actually count all of the tests. currently looks for qr/^\s_(is|is_deeply|like|ok|pass)\s_(/i;, but it doesn't include fail(), and is not really that conclusive of a match
  • also, this is currently done by opening each .pl in %INC and reading line by line.. should convert this to reading the files in memory (we've already required them anyway). using *.pl to match about_.pl and road_to_illumination.pl, should tighten that up
@chorankates-sfdc
Copy link
Contributor Author

ht to markwhi on this gist, but adding B::Deparse is not the solution for Perl::Koans. the second half of that issue was already resolved in the fix for issue #1

@chorankates-sfdc
Copy link
Contributor Author

regarding the first problem, it leads to weirdness like this:

$ perl about_exceptions.pl
ok 1 - empty strings are returned for failed operations
ok 2 - $! is populated with the error message for failed operations
not ok 3 - empty strings are returned for failed operations

Failed test 'empty strings are returned for failed operations'

at about_exceptions.pl line 52.

XXXXXXXXXXXXXXXXXXXXXXXXX_________________________ 3/6

...

$ perl about_exceptions.pl
ok 1 - empty strings are returned for failed operations
ok 2 - $! is populated with the error message for failed operations
ok 3 - empty strings are returned for failed operations
not ok 4 - eval returns undef if fatal error hit

Failed test 'eval returns undef if fatal error hit'

at about_exceptions.pl line 69.

got: undef

expected: '__'

XXXXXXXXXXXXXXXXXXXXXXXXXXXX______________________ 4/7

in order to succeed this test, must change a hardcoded 'fail' to 'pass'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant