403Webshell
Server IP : 164.138.27.172  /  Your IP : 216.73.216.143
Web Server : nginx/1.27.4
System : Linux cookingdream 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : www-adm ( 1001)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/jonasn/.cpan/build/CPAN-2.34-1/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/jonasn/.cpan/build/CPAN-2.34-1/t/43distroprefspref.t
use strict;

use Test::More;
use CPAN::Distroprefs;

plan tests => 21;

my $p;

# start with something simple
$p = CPAN::Distroprefs::Pref->new({
  data => {
    match => {
      distribution => "^XML",
    },
  },
});

ok($p->data);
ok($p->has_match("distribution"));
ok(!$p->has_match("perl"));
ok($p->has_any_match);
ok($p->has_valid_subkeys);

ok($p->matches({
   distribution => "XML::Parser",
}));

ok(!$p->matches({
   distribution => "Foo::XML",
}));

# still simple, but now a negated match
$p = CPAN::Distroprefs::Pref->new({
  data => {
    match => {
      not_distribution => "^XML",
    },
  },
});

ok($p->data);
ok($p->has_match("distribution"));
ok(!$p->has_match("perl"));
ok($p->has_any_match);
ok($p->has_valid_subkeys);

ok(!$p->matches({
   distribution => "XML::Parser",
}));

ok($p->matches({
   distribution => "Foo::XML",
}));

# try some complicated matches
$p = CPAN::Distroprefs::Pref->new({
  data => {
    match => {
      distribution => "^XML",
      not_distribution => "Parser",
      perlconfig => {
	osname => "linux",
        not_cc => "^gcc\$",
      },
    },
  },
});

ok(!$p->matches({
  distribution => "XML::Parser",
}));

ok($p->matches({
  distribution => "XML::Foo",
  perlconfig => {
    osname => "linux",
    cc => "cc",
  },
}));

ok(!$p->matches({
  distribution => "XML::Foo",
  perlconfig => {
    osname => "linux",
    cc => "gcc",
  },
}));

ok(!$p->matches({
  distribution => "XML::Foo",
  perlconfig => {
    osname => "darwin",
    cc => "cc",
  },
}));

# try match on module
$p = CPAN::Distroprefs::Pref->new({
  data => {
    match => {
      module => "^LWP",
      not_module => "Foo",
    },
  },
});

ok($p->matches({
   module => ["LWP::UserAgent"],
}));

ok(!$p->matches({
   module => ["LWP::UserAgent", "LWP::Foo"],
}));

ok(!$p->matches({
   module => ["Bar"],
}));

# Local Variables:
# mode: cperl
# cperl-indent-level: 2
# End:

Youez - 2016 - github.com/yon3zu
LinuXploit