Test-More / Test-More/test-more

Test2::Compare::Custom documentation

Open
#971 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
149
Forks
98
PR merge metrics
No merged PRs in 30d

Description

The documentation for Test2::Compare::Custom seems to suggest that arguments are passed in as a list:

https://metacpan.org/pod/Test2::Compare::Custom#ARGUMENTS

code => sub {    my ($got, $exists, $operator, $name) = @_;    return ref($got) ? 1 : 0;},
--

But they seem to being passed in as key/value pairs:

https://metacpan.org/source/EXODIST/Test2-Suite-0.000072/lib/Test2/Compare/Custom.pm#L32

When I treated the arguments as list/value pairs, my code worked:

  my $url_check = Test2::Compare::Custom->new(
    name => 'UrlCheck',
    code => sub {
      # this seems to be different from the
      # documentation?
      my %args = @_;
      my $url = URI->new($args{got});
      return 0 unless $url->scheme eq 'file'
      &&              $url->host   eq 'localhost'
      &&              $url->path   eq $example1;
      1;
    },
  );

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Test2::Compare::Custom documentation at the metacpan ARGUMENTS section and compare it with lib/Test2/Compare/Custom.pm around line 32. Confirm how the callback arguments are passed, then update the documentation and verify that the example reflects the actual behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.