Skip to content

Commit

Permalink
add test, Makefile.PL
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuho Oku committed Oct 8, 2009
1 parent 0cdefb1 commit e0d80ea
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
21 changes: 21 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use inc::Module::Install;

name 'cppref';
all_from 'cppref';
readme_from 'cppref';

no_index 'orig';

configure_requires 'Module::Install::ReadmeFromPod';
configure_requires 'File::Slurp';
requires 'File::ShareDir';

install_script 'cppref';
install_share 'doc';

auto_include;
auto_install;

WriteAll;

do 'tidy.pl';
29 changes: 28 additions & 1 deletion cppref
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ use File::Basename;
use File::Find ();
use File::ShareDir ();

our $VERSION = '0.01';

my $doc_dir = "doc";
eval {
$doc_dir = File::ShareDir::dist_dir('cppref') . "/doc";
$doc_dir = File::ShareDir::dist_dir('cppref');
};

my $name = shift @ARGV || 'start';
Expand Down Expand Up @@ -51,3 +53,28 @@ sub open_file {
exec 'w3m', $fn;
die "failed to exec w3m:$!";
}

__END__
=head1 NAME
cppref - man-style access to cppreference.com documents
=head1 SYNOPSIS
% cppref # prints top page
% cppref vector # prints vector docs
=head1 AUTHOR
Copyright (c) 2009 Kazuho Oku All rights reserved
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
The documents are from http://www.cppreference.com/ (under Creative Commons Attribution 3.0 license).
=cut
13 changes: 13 additions & 0 deletions t/00base.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use strict;
use warnings;

use Test::More tests => 7;

is(system("blib/script/cppref > /dev/null"), 0, 'top page');
is(system("blib/script/cppref stl::vector::push_back > /dev/null"), 0, 'exact path');
is(system("blib/script/cppref stl/vector/push_back > /dev/null"), 0, 'exact path using slashes');
is(system("blib/script/cppref stl > /dev/null"), 0, 'dir');
is(system("blib/script/cppref faq > /dev/null"), 0, 'search');
is(system("blib/script/cppref hokhokhok > /dev/null 2>&1"), 256, 'not found');
is(system("blib/script/cppref push_back > /dev/null 2>&1"), 512, 'multiple choices');

0 comments on commit e0d80ea

Please sign in to comment.