Commit 2a3450e4 authored by Jonas Smedegaard's avatar Jonas Smedegaard

Improve package testsuite.

parent 6963a3f5
Test-Command: prove debian/tests/*.t
Depends:
figlet,
libfile-homedir-perl,
libtest-command-simple-perl,
libtest-expect-perl,
libtest-tempdir-tiny-perl,
perl,
toilet-fonts,
@,
Test-Command: prove debian/tests/sharedlibs/*.t
Depends:
libfile-homedir-perl,
libtest-command-simple-perl,
libtest-tempdir-tiny-perl,
perl,
@,
Test-Command: EXTENDED_TESTING=1 prove debian/tests/net/*.t
Restrictions: flaky
Depends:
libfile-homedir-perl,
libtest-command-simple-perl,
libtest-tempdir-tiny-perl,
perl,
......
use strict;
use warnings;
use Test::More;
use File::HomeDir::Test;
use File::HomeDir;
use File::Path qw(make_path);
use Test::TempDir::Tiny;
use Test::Command::Simple;
# network access may be absent or unreliable
plan skip_all => 'network test skipped when EXTENDED_TESTING is unset'
unless ($ENV{EXTENDED_TESTING});
my @CMD = qw/ontospy gendocs/;
my $CMD = join ' ', @CMD;
ok $ENV{HOME} = File::HomeDir->my_home, 'create fake $HOME';
ok make_path "$ENV{HOME}/.ontospy/models", 'create $HOME/.ontospy/models';
in_tempdir "gendocs network" => sub {
run_ok @CMD, qw(--type 1 http://xmlns.com/foaf/spec/);
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
};
done_testing;
use strict;
use warnings;
use Test::More;
use File::HomeDir::Test;
use File::HomeDir;
use File::Path qw(make_path);
use Test::TempDir::Tiny;
use Test::Command::Simple;
# network access may be absent or unreliable
plan skip_all => 'network test skipped when EXTENDED_TESTING is unset'
unless ($ENV{EXTENDED_TESTING});
my @CMD = qw/ontospy lib/;
my $CMD = join ' ', @CMD;
ok $ENV{HOME} = File::HomeDir->my_home, 'create fake $HOME';
ok make_path "$ENV{HOME}/.ontospy/models", 'create $HOME/.ontospy/models';
in_tempdir "lib bootstrap" => sub {
run_ok 'sh', '-c', "yes | $CMD --bootstrap";
like stdout, qr/The following ontologies will be imported/, 'Testing stdout';
like stderr, qr/Bootstrap command completed/, 'Testing stderr';
};
done_testing;
use strict;
use warnings;
use Test::More;
use Test::Command::Simple;
use Cwd qw(cwd);
use File::HomeDir::Test;
use File::HomeDir;
use File::Path qw(make_path);
use Test::TempDir::Tiny;
my @CMD = qw/ontospy gendocs/;
my $CMD = join ' ', @CMD;
run_ok @CMD;
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok @CMD, '--help';
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
my $FOAF = 'file://' . cwd . '/ontospy/tests/rdf/foaf.rdf';
ok $ENV{HOME} = File::HomeDir->my_home, 'create fake $HOME';
ok make_path "$ENV{HOME}/.ontospy/models", 'create $HOME/.ontospy/models';
in_tempdir "gendocs" => sub {
run_ok @CMD, qw(--type 1), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
run_ok @CMD, qw(--type 3), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
};
done_testing;
use strict;
use warnings;
use Test::More;
use Test::Command::Simple;
my @CMD = qw/ontospy lib/;
my $CMD = join ' ', @CMD;
run_ok @CMD;
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok @CMD, '--help';
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
done_testing;
use strict;
use warnings;
use Test::More;
use Test::Command::Simple;
my @CMD = qw/ontospy scan/;
my $CMD = join ' ', @CMD;
run_ok @CMD;
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok @CMD, '--help';
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
done_testing;
use strict;
use warnings;
use Test::More;
use Test::Command::Simple;
my @CMD = qw/ontospy ser/;
my $CMD = join ' ', @CMD;
run_ok @CMD;
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok @CMD, '--help';
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
done_testing;
use strict;
use warnings;
use Test::More;
use Test::Command::Simple;
use File::HomeDir::Test;
use File::HomeDir;
use File::Path qw(make_path);
use Test::TempDir::Tiny;
use Test::Expect;
my @CMD = qw/ontospy shell/;
my $CMD = join ' ', @CMD;
run_ok @CMD, '--help';
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
ok $ENV{HOME} = File::HomeDir->my_home, 'create fake $HOME';
ok make_path "$ENV{HOME}/.ontospy/models", 'create $HOME/.ontospy/models';
in_tempdir "shell" => sub {
expect_run(
command => [@CMD],
prompt => [ -re => 'Ontospy\]\S+>\s+' ],
quit => 'quit',
);
expect_send('help', 'request help');
expect_like(qr/Commands available/, 'expect help');
expect_send('help foo', 'request help on foo');
expect_like(qr/No help on foo/, 'expect no help on foo');
expect_send('help help', 'request help on help');
expect_like(qr/List available commands with "help" or detailed help with "help cmd"/, 'expect help on help');
expect_send('info', 'request info');
expect_like(qr/No graph selected/, 'expect no info');
expect_quit;
};
done_testing;
use strict;
use warnings;
use Test::More;
use Test::Command::Simple;
my @CMD = qw/ontospy utils/;
my $CMD = join ' ', @CMD;
run_ok @CMD;
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok @CMD, '--help';
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
done_testing;
......@@ -6,32 +6,12 @@ use Test::Command::Simple;
my $CMD = 'ontospy';
run_ok $CMD, qw/--help/;
run_ok $CMD;
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok $CMD, qw/scan --help/;
like stdout, qr/Usage: $CMD scan/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok $CMD, qw/gendocs --help/;
like stdout, qr/Usage: $CMD gendocs/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok $CMD, qw/lib --help/;
like stdout, qr/Usage: $CMD lib/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok $CMD, qw/shell --help/;
like stdout, qr/Usage: $CMD shell/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok $CMD, qw/ser --help/;
like stdout, qr/Usage: $CMD ser/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
run_ok $CMD, qw/utils --help/;
like stdout, qr/Usage: $CMD utils/, 'Testing stdout';
run_ok $CMD, '--help';
like stdout, qr/Usage: $CMD/, 'Testing stdout';
cmp_ok stderr, 'eq', '', 'Testing stderr';
done_testing;
use strict;
use warnings;
use Test::More;
use Test::Command::Simple;
use Cwd qw(cwd);
use File::HomeDir::Test;
use File::HomeDir;
use File::Path qw(make_path);
use Test::TempDir::Tiny;
my @CMD = qw/ontospy gendocs/;
my $CMD = join ' ', @CMD;
my $FOAF = 'file://' . cwd . '/ontospy/tests/rdf/foaf.rdf';
ok $ENV{HOME} = File::HomeDir->my_home, 'create fake $HOME';
ok make_path "$ENV{HOME}/.ontospy/models", 'create $HOME/.ontospy/models';
in_tempdir "gendocs sharedlibs" => sub {
run_ok @CMD, qw(--type 2), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
run_ok @CMD, qw(--type 4), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
run_ok @CMD, qw(--type 5), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
run_ok @CMD, qw(--type 6), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
run_ok @CMD, qw(--type 7), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
run_ok @CMD, qw(--type 8), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
run_ok @CMD, qw(--type 9), $FOAF;
like stdout, qr/Loading graph.*\nBuilding visualization/, 'Testing stdout';
like stderr, qr(^Done\.), 'Testing stderr';
};
done_testing;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment