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

DNE() with in_set() fails #10

Closed
alfiedotwtf opened this issue Mar 30, 2016 · 7 comments
Closed

DNE() with in_set() fails #10

alfiedotwtf opened this issue Mar 30, 2016 · 7 comments
Labels

Comments

@alfiedotwtf
Copy link
Contributor

Maybe I'm doing something wrong, but I would have expected that all of these tests should pass:

#!/usr/bin/perl

use strict;
use warnings;

use Test2::Bundle::Extended;

my $check = hash {
  field first   => 42;
  field second  => undef;
  field third   => DNE();
  field fourth  => in_set(42, undef);
  field fifth   => in_set(42, undef);
  field sixth   => in_set(42, DNE());
  field seventh => in_set(42, DNE());
};

is(
  {
    first   => 42,
    second  => undef,
    # third DNE
    fourth  => 42,
    fifth   => undef,
    sixth   => 42,
    # seventh DNE <- fails :(
  },
  $check
);
@alfiedotwtf
Copy link
Contributor Author

Also note that flipping the in_set() to a not_in_set() also doesn't work as I expected:

field seventh => not_in_set(99, D());

@dmaestro
Copy link

I've also run into this since your excellent talk at TPC (aka YAPC) Monday, and I've been trying out Test2. Would be nice to have an E() quick operator that does what not_in_set(DNE()) should do.

@exodist exodist added the bug label Jun 23, 2016
@exodist
Copy link
Member

exodist commented Jun 23, 2016

will fix, and probably gonna add E() as well.

@exodist
Copy link
Member

exodist commented Jun 24, 2016

Did all this on my flight home. Will push to github when I can.

exodist added a commit that referenced this issue Jun 24, 2016
    - Add all_keys() to Compare tools
    - add all_vals() to Compare tools
    - add all_items() to Compare tools
    - Fix in_set(DNE) (#10)
    - Add E()
    - Proper line reporting for shortcuts.
@exodist
Copy link
Member

exodist commented Jun 24, 2016

Fixed in latest TRIAL release

@alfiedotwtf
Copy link
Contributor Author

Awesome! Thanks. Currently on leave for a week, so will check them out when I get back.

@alfiedotwtf
Copy link
Contributor Author

Looks good. Thanks!

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

3 participants