Mercurial > hg > nginx-tests
comparison js_headers.t @ 1811:520fb74cce4c
Tests: improved njs version check to account multi digit versions.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Fri, 02 Dec 2022 17:46:22 -0800 |
parents | 386748f328b1 |
children |
comparison
equal
deleted
inserted
replaced
1810:7cf848422b28 | 1811:520fb74cce4c |
---|---|
529 'GET /hdr_sorted_keys HTTP/1.0' . CRLF | 529 'GET /hdr_sorted_keys HTTP/1.0' . CRLF |
530 . 'Host: localhost' . CRLF . CRLF | 530 . 'Host: localhost' . CRLF . CRLF |
531 ), qr/a,b,c/, 'r.headersOut sorted keys'); | 531 ), qr/a,b,c/, 'r.headersOut sorted keys'); |
532 | 532 |
533 TODO: { | 533 TODO: { |
534 local $TODO = 'not yet' | 534 local $TODO = 'not yet' unless has_version('0.7.6'); |
535 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.7.6'; | |
536 | 535 |
537 like(http_get('/hdr_out_special_set'), qr/CE: abc/, | 536 like(http_get('/hdr_out_special_set'), qr/CE: abc/, |
538 'r.headerOut special set'); | 537 'r.headerOut special set'); |
539 | 538 |
540 like(http_get('/copy_subrequest_hdrs'), | 539 like(http_get('/copy_subrequest_hdrs'), |
546 'subrequest copy special'); | 545 'subrequest copy special'); |
547 | 546 |
548 } | 547 } |
549 | 548 |
550 ############################################################################### | 549 ############################################################################### |
550 | |
551 sub has_version { | |
552 my $need = shift; | |
553 | |
554 http_get('/njs') =~ /^([.0-9]+)$/m; | |
555 | |
556 my @v = split(/\./, $1); | |
557 my ($n, $v); | |
558 | |
559 for $n (split(/\./, $need)) { | |
560 $v = shift @v || 0; | |
561 return 0 if $n > $v; | |
562 return 1 if $v > $n; | |
563 } | |
564 | |
565 return 1; | |
566 } | |
567 | |
568 ############################################################################### |