[PATCH 04 of 11] Tests: fixed server_tokens tests for build names with spaces

Sergey Kandaurov pluknet at nginx.com
Thu May 11 11:48:48 UTC 2023


> On 17 Apr 2023, at 07:31, Maxim Dounin <mdounin at mdounin.ru> wrote:
> 
> # HG changeset patch
> # User Maxim Dounin <mdounin at mdounin.ru>
> # Date 1681702253 -10800
> #      Mon Apr 17 06:30:53 2023 +0300
> # Node ID 605cab711606724e5879e8a81d5d21797e5ddcfb
> # Parent  f704912ed09f3494a815709710c3744b0adca50b
> Tests: fixed server_tokens tests for build names with spaces.
> 
> Build names can contain spaces, and previously used pattern, "--build=(\S+)",
> failed to properly match such build names.  Instead, now we simply test
> that some build name is provided in the Server header.  Further, the

in the Server header and error pages

(but I won't insist, existing wording looks clear enough)

> $t->has_module() method is now used to check if a build name is set
> instead of directly testing the $t->{_configure_args} internal field.
> 
> diff --git a/h2_server_tokens.t b/h2_server_tokens.t
> --- a/h2_server_tokens.t
> +++ b/h2_server_tokens.t
> @@ -106,7 +106,7 @@ like(header_server('/on/200'), qr/^$re$/
> like(header_server('/on/404'), qr/^$re$/, 'http2 tokens on 404');
> like(body('/on/404'), $re, 'http2 tokens on 404 body');
> 
> -$re = qr/$re \Q($1)\E/ if $t->{_configure_args} =~ /--build=(\S+)/;
> +$re = qr/$re \(.*\)/ if $t->has_module('--build=');
> 
> like(header_server('/b/200'), qr/^$re$/, 'http2 tokens build 200');
> like(header_server('/b/404'), qr/^$re$/, 'http2 tokens build 404');
> diff --git a/server_tokens.t b/server_tokens.t
> --- a/server_tokens.t
> +++ b/server_tokens.t
> @@ -105,7 +105,7 @@ like(http_get_server('/on/200'), $re, 't
> like(http_get_server('/on/404'), $re, 'tokens on 404');
> like(http_body('/on/404'), $re, 'tokens on 404 body');
> 
> -$re = qr/$re \Q($1)\E/ if $t->{_configure_args} =~ /--build=(\S+)/;
> +$re = qr/$re \(.*\)/ if $t->has_module('--build=');
> 
> like(http_get_server('/b/200'), $re, 'tokens build 200');
> like(http_get_server('/b/404'), $re, 'tokens build 404');

Looks good.

-- 
Sergey Kandaurov


More information about the nginx-devel mailing list