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

T() and F() do not handle references properly #247

Closed
exodist opened this issue May 26, 2022 · 0 comments
Closed

T() and F() do not handle references properly #247

exodist opened this issue May 26, 2022 · 0 comments
Assignees
Labels

Comments

@exodist
Copy link
Member

exodist commented May 26, 2022

This passes (It should not)

use v5.10;
use Mojo::JSON qw(encode_json decode_json);
use Test2::Tools::Compare qw(hash is T F end etc field);

my $data = '{ "aaa": true, "bbb": false }';
my $h = decode_json($data);

my $cmp = hash {
  field aaa => F();
  field bbb => T();
  end();
};
  
is($h, $cmp, 'Test');

done_testing;

The reference check in here: https://metacpan.org/dist/Test2-Suite/source/lib/Test2/Tools/Compare.pm#L252 is incorrect. Several of the quick-checks have similar incorrect reference logic.

@exodist exodist self-assigned this May 26, 2022
@exodist exodist added the bug label May 26, 2022
exodist added a commit that referenced this issue Apr 28, 2023
    - Fix #247
    - Fix changes file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant