From cca5b123ae93a811b335815b0f754c4e4f44c8d4 Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Mon, 16 May 2011 20:12:51 -0700 Subject: Bug 657542: Make the AND/OR tests for xt/search.t function properly and catch known-broken tests as it's supposed to. r=mkanat, a=mkanat (module owner) --- xt/lib/Bugzilla/Test/Search/FieldTest.pm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'xt/lib/Bugzilla/Test/Search/FieldTest.pm') diff --git a/xt/lib/Bugzilla/Test/Search/FieldTest.pm b/xt/lib/Bugzilla/Test/Search/FieldTest.pm index 02e0df06c..283a90d16 100644 --- a/xt/lib/Bugzilla/Test/Search/FieldTest.pm +++ b/xt/lib/Bugzilla/Test/Search/FieldTest.pm @@ -156,9 +156,12 @@ sub debug_value { # result was equal to its first value. sub transformed_value_was_equal { my ($self, $number, $value) = @_; - if (defined $value) { + if (@_ > 2) { $self->{transformed_value_was_equal}->{$number} = $value; + $self->search_test->was_equal_cache($self, $number, $value); } + my $cached = $self->search_test->was_equal_cache($self, $number); + return $cached if defined $cached; return $self->{transformed_value_was_equal}->{$number}; } @@ -215,6 +218,23 @@ sub contains_known_broken { return undef; } +# Used by subclasses. Checks both bug_is_contained and contains_known_broken +# to tell you whether or not the bug will *actually* be found by the test. +sub will_actually_contain_bug { + my ($self, $number) = @_; + my $is_contained = $self->bug_is_contained($number) ? 1 : 0; + my $is_broken = $self->contains_known_broken($number) ? 1 : 0; + + # If the test is supposed to contain the bug and *isn't* broken, + # then the test will contain the bug. + return 1 if ($is_contained and !$is_broken); + # If this test is *not* supposed to contain the bug, but that test is + # broken, then this test *will* contain the bug. + return 1 if (!$is_contained and $is_broken); + + return 0; +} + # Returns a string if creating a Bugzilla::Search object throws an error, # with this field/operator/value combination. sub search_known_broken { -- cgit v1.2.3-24-g4f1b