]> Sergey Matveev's repositories - public-inbox.git/blob - xt/solver.t
solver: do not enforce order on extended headers
[public-inbox.git] / xt / solver.t
1 #!perl -w
2 # Copyright (C) 2020 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use strict;
5 use Test::More;
6 use PublicInbox::TestCommon;
7 use PublicInbox::Config; # this relies on PI_CONFIG // ~/.public-inbox/config
8 use PublicInbox::WWW;
9 my @psgi = qw(HTTP::Request::Common Plack::Test URI::Escape Plack::Builder);
10 require_mods(qw(DBD::SQLite Search::Xapian), @psgi);
11 use_ok($_) for @psgi;
12 my $cfg = PublicInbox::Config->new;
13 my $www = PublicInbox::WWW->new($cfg);
14 my $app = sub {
15         my $env = shift;
16         $env->{'psgi.errors'} = \*STDERR;
17         $www->call($env);
18 };
19
20 # TODO: convert these to self-contained test cases
21 my $todo = {
22         'git' => [
23                 'eebf7a8/s/?b=t%2Ftest-lib.sh',
24                 'eb580ca513/s/?b=remote-odb.c',
25                 '776fa90f7f/s/?b=contrib/git-jump/git-jump',
26                 '5cd8845/s/?b=submodule.c',
27                 '81c1164ae5/s/?b=builtin/log.c',
28                 '6aa8857a11/s/?b=protocol.c', # TODO: i/, w/ instead of a/ b/
29                 '96f1c7f/s/', # TODO: b=contrib/completion/git-completion.bash
30                 'b76f2c0/s/?b=po/zh_CN.po',
31         ],
32 };
33
34 my ($ibx, $urls);
35 my $client = sub {
36         my ($cb) = @_;
37         for (@$urls) {
38                 my $url = "/$ibx/$_";
39                 my $res = $cb->(GET($url));
40                 is($res->code, 200, $url);
41                 next if $res->code == 200;
42                 # diag $res->content;
43                 diag "$url failed";
44         }
45 };
46
47 while (($ibx, $urls) = each %$todo) {
48         SKIP: {
49                 if (!$cfg->lookup_name($ibx)) {
50                         skip("$ibx not configured", scalar(@$urls));
51                 }
52                 test_psgi($app, $client);
53         }
54 }
55
56 done_testing();
57 1;