-#!/usr/bin/perl -w
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 2108;
+use RT::Test nodata => 1, tests => undef;
use RT::Ticket;
my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
run_test( $query, %checks );
} }
}
-# XXX: It
-# @queries = (
-# '? AND ? AND ?' => sub { $_[0] and $_[1] and $_[2] },
-# '(? OR ?) AND ?' => sub { return (($_[0] or $_[1]) and $_[2]) },
-# '? OR (? AND ?)' => sub { $_[0] or ($_[1] and $_[2]) },
-# '(? AND ?) OR ?' => sub { ($_[0] and $_[1]) or $_[2] },
-# '? AND (? OR ?)' => sub { $_[0] and ($_[1] or $_[2]) },
-# '? OR ? OR ?' => sub { $_[0] or $_[1] or $_[2] },
-# );
-# while ( my ($template, $t_cb) = splice @queries, 0, 2 ) {
-# my @atmp = @conditions;
-# while ( my ($a, $a_cb) = splice @atmp, 0, 2 ) {
-# my @btmp = @conditions;
-# while ( my ($b, $b_cb) = splice @btmp, 0, 2 ) {
-# next if $a eq $b;
-# my @ctmp = @conditions;
-# while ( my ($c, $c_cb) = splice @ctmp, 0, 2 ) {
-# next if $a eq $c;
-# next if $b eq $c;
-#
-# my %checks = ();
-# foreach my $ticket ( @tickets ) {
-# my $s = $ticket->Subject;
-# $checks{ $s } = $t_cb->( scalar $a_cb->($s), scalar $b_cb->($s), scalar $c_cb->($s) );
-# }
-#
-# my $query = $template;
-# foreach my $tmp ($a, $b, $c) {
-# $query =~ s/\?/$tmp/;
-# }
-#
-# run_test( $query, %checks );
-# } } }
-# }
+ return unless $ENV{'RT_TEST_HEAVY'};
+
+ @queries = (
+ '? AND ? AND ?' => sub { $_[0] and $_[1] and $_[2] },
+ '(? OR ?) AND ?' => sub { return (($_[0] or $_[1]) and $_[2]) },
+ '? OR (? AND ?)' => sub { $_[0] or ($_[1] and $_[2]) },
+ '(? AND ?) OR ?' => sub { ($_[0] and $_[1]) or $_[2] },
+ '? AND (? OR ?)' => sub { $_[0] and ($_[1] or $_[2]) },
+ '? OR ? OR ?' => sub { $_[0] or $_[1] or $_[2] },
+ );
+ while ( my ($template, $t_cb) = splice @queries, 0, 2 ) {
+ my @atmp = @conditions;
+ while ( my ($a, $a_cb) = splice @atmp, 0, 2 ) {
+ my @btmp = @conditions;
+ while ( my ($b, $b_cb) = splice @btmp, 0, 2 ) {
+ next if $a eq $b;
+ my @ctmp = @conditions;
+ while ( my ($c, $c_cb) = splice @ctmp, 0, 2 ) {
+ next if $a eq $c;
+ next if $b eq $c;
+
+ my %checks = ();
+ foreach my $ticket ( @tickets ) {
+ my $s = $ticket->Subject;
+ $checks{ $s } = $t_cb->( scalar $a_cb->($s), scalar $b_cb->($s), scalar $c_cb->($s) );
+ }
+
+ my $query = $template;
+ foreach my $tmp ($a, $b, $c) {
+ $query =~ s/\?/$tmp/;
+ }
+
+ run_test( $query, %checks );
+ } } }
+ }
}
@conditions = (
'Cc = "not@exist"' => sub { 0 },
'Cc != "not@exist"' => sub { 1 },
- 'Cc IS NULL' => sub { $_[0] =~ 'c:-;' },
- 'Cc IS NOT NULL' => sub { $_[0] !~ 'c:-;' },
+ 'Cc IS NULL' => sub { $_[0] =~ /c:-;/ },
+ 'Cc IS NOT NULL' => sub { $_[0] !~ /c:-;/ },
'Cc = "x@foo.com"' => sub { $_[0] =~ /c:[^;]*x/ },
'Cc != "x@foo.com"' => sub { $_[0] !~ /c:[^;]*x/ },
'Cc LIKE "@bar.com"' => sub { $_[0] =~ /c:[^;]*(?:y|z)/ },
'Requestor = "not@exist"' => sub { 0 },
'Requestor != "not@exist"' => sub { 1 },
- 'Requestor IS NULL' => sub { $_[0] =~ 'r:-;' },
- 'Requestor IS NOT NULL' => sub { $_[0] !~ 'r:-;' },
+ 'Requestor IS NULL' => sub { $_[0] =~ /r:-;/ },
+ 'Requestor IS NOT NULL' => sub { $_[0] !~ /r:-;/ },
'Requestor = "x@foo.com"' => sub { $_[0] =~ /r:[^;]*x/ },
'Requestor != "x@foo.com"' => sub { $_[0] !~ /r:[^;]*x/ },
'Requestor LIKE "@bar.com"' => sub { $_[0] =~ /r:[^;]*(?:y|z)/ },
'Subject LIKE "ne"' => sub { 0 },
'Subject NOT LIKE "ne"' => sub { 1 },
'Subject = "r:x;c:y;"' => sub { $_[0] eq 'r:x;c:y;' },
- 'Subject LIKE "x"' => sub { $_[0] =~ 'x' },
+ 'Subject LIKE "x"' => sub { $_[0] =~ /x/ },
);
@tickets = generate_tix();
}
@tickets = ();
-
+done_testing();