From 2b912b751b06bbbbe6e80e4210af5b85fc21663d Mon Sep 17 00:00:00 2001 From: des Date: Mon, 13 Aug 2007 18:36:15 +0000 Subject: [PATCH] Fix assert_xid() and add assert_no_xid() (useful for piped requests) git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1841 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-tools/regress/lib/Varnish/Test/Case.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/varnish-tools/regress/lib/Varnish/Test/Case.pm b/varnish-tools/regress/lib/Varnish/Test/Case.pm index 2b50fd92..a39bbf34 100644 --- a/varnish-tools/regress/lib/Varnish/Test/Case.pm +++ b/varnish-tools/regress/lib/Varnish/Test/Case.pm @@ -313,11 +313,21 @@ sub assert_xid($;$) { unless defined($resp); die "No X-Varnish header\n" - unless (!$resp->header('X-Varnish')); + unless (defined($resp->header('X-Varnish'))); die "Invalid X-Varnish header\n" unless ($resp->header('X-Varnish') =~ m/^\d+(?: \d+)?$/); } +sub assert_no_xid($;$) { + my ($self, $resp) = @_; + + $resp = $self->{'cached_response'} + unless defined($resp); + + die "X-Varnish header present where none expected\n" + if (defined($resp->header('X-Varnish'))); +} + sub assert_cached($;$) { my ($self, $resp) = @_; -- 2.39.5