source: main/trunk/greenstone2/perllib/cpan/Mojolicious/Command/test.pm@ 32205

Last change on this file since 32205 was 32205, checked in by ak19, 6 years ago

First set of commits to do with implementing the new 'paged_html' output option of PDFPlugin that uses using xpdftools' new pdftohtml. So far tested only on Linux (64 bit), but things work there so I'm optimistically committing the changes since they work. 2. Committing the pre-built Linux binaries of XPDFtools for both 32 and 64 bit built by the XPDF group. 2. To use the correct bitness variant of xpdftools, setup.bash now exports the BITNESS env var, consulted by gsConvert.pl. 3. All the perl code changes to do with using xpdf tools' pdftohtml to generate paged_html and feed it in the desired form into GS(3): gsConvert.pl, PDFPlugin.pm and its parent ConvertBinaryPFile.pm have been modified to make it all work. xpdftools' pdftohtml generates a folder containing an html file and a screenshot for each page in a PDF (as well as an index.html linking to each page's html). However, we want a single html file that contains each individual 'page' html's content in a div, and need to do some further HTML style, attribute and structure modifications to massage the xpdftool output to what we want for GS. In order to parse and manipulate the HTML 'DOM' to do this, we're using the Mojo::DOM package that Dr Bainbridge found and which he's compiled up. Mojo::DOM is therefore also committed in this revision. Some further changes and some display fixes are required, but need to check with the others about that.

File size: 2.0 KB
Line 
1package Mojolicious::Command::test;
2use Mojo::Base 'Mojolicious::Command';
3
4use Mojo::Util 'getopt';
5
6has description => 'Run tests';
7has usage => sub { shift->extract_usage };
8
9sub run {
10 my ($self, @args) = @_;
11
12 getopt \@args, 'v|verbose' => \$ENV{HARNESS_VERBOSE};
13
14 if (!@args && (my $tests = $self->app->home->child('t'))) {
15 die "Can't find test directory.\n" unless -d $tests;
16 @args = $tests->list_tree->grep(qr/\.t$/)->map('to_string')->each;
17 say qq{Running tests from "$tests".};
18 }
19
20 $ENV{HARNESS_OPTIONS} //= 'c';
21 require Test::Harness;
22 local $Test::Harness::switches = '';
23 Test::Harness::runtests(sort @args);
24}
25
261;
27
28=encoding utf8
29
30=head1 NAME
31
32Mojolicious::Command::test - Test command
33
34=head1 SYNOPSIS
35
36 Usage: APPLICATION test [OPTIONS] [TESTS]
37
38 ./myapp.pl test
39 ./myapp.pl test t/foo.t
40 ./myapp.pl test -v t/foo/*.t
41
42 Options:
43 -h, --help Show this summary of available options
44 -v, --verbose Print verbose debug information to STDERR
45
46=head1 DESCRIPTION
47
48L<Mojolicious::Command::test> runs application tests from the C<t> directory.
49
50This is a core command, that means it is always enabled and its code a good
51example for learning to build new commands, you're welcome to fork it.
52
53See L<Mojolicious::Commands/"COMMANDS"> for a list of commands that are
54available by default.
55
56=head1 ATTRIBUTES
57
58L<Mojolicious::Command::test> inherits all attributes from
59L<Mojolicious::Command> and implements the following new ones.
60
61=head2 description
62
63 my $description = $test->description;
64 $test = $test->description('Foo');
65
66Short description of this command, used for the command list.
67
68=head2 usage
69
70 my $usage = $test->usage;
71 $test = $test->usage('Foo');
72
73Usage information for this command, used for the help screen.
74
75=head1 METHODS
76
77L<Mojolicious::Command::test> inherits all methods from L<Mojolicious::Command>
78and implements the following new ones.
79
80=head2 run
81
82 $test->run(@ARGV);
83
84Run this command.
85
86=head1 SEE ALSO
87
88L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
89
90=cut
Note: See TracBrowser for help on using the repository browser.