From: Karen Etheridge Date: Mon, 9 Sep 2013 22:00:58 +0000 (-0700) Subject: check result of eval operation rather than looking at $@ X-Git-Tag: v1.003022~3^2~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=59500b7eafe06b09cccd3b4d4b80b0728698d034;p=p5sagit%2FDevel-REPL.git check result of eval operation rather than looking at $@ --- diff --git a/t/load_core.t b/t/load_core.t index 25f635c..cab5a07 100755 --- a/t/load_core.t +++ b/t/load_core.t @@ -9,76 +9,55 @@ use_ok('Devel::REPL::Script'); use_ok('Devel::REPL::Plugin::Colors'); use_ok('Devel::REPL::Plugin::Commands'); -eval 'use PPI'; -unless ($@) { - use_ok('Devel::REPL::Plugin::Completion'); -} - -eval 'use File::Next'; -unless ($@) { - use_ok('Devel::REPL::Plugin::CompletionDriver::INC'); -} - -eval 'use B::Keywords'; -unless ($@) { - use_ok('Devel::REPL::Plugin::CompletionDriver::Keywords'); -} - -eval 'use Lexical::Persistence'; -unless ($@) { - use_ok('Devel::REPL::Plugin::CompletionDriver::LexEnv'); - use_ok('Devel::REPL::Plugin::LexEnv'); -} +eval 'use PPI; 1' + and use_ok('Devel::REPL::Plugin::Completion'); + +eval 'use File::Next; 1' + and use_ok('Devel::REPL::Plugin::CompletionDriver::INC'); + +eval 'use B::Keywords; 1' + and use_ok('Devel::REPL::Plugin::CompletionDriver::Keywords'); + +eval 'use Lexical::Persistence; 1' + and use_ok('Devel::REPL::Plugin::CompletionDriver::LexEnv') + and use_ok('Devel::REPL::Plugin::LexEnv'); use_ok('Devel::REPL::Plugin::CompletionDriver::Globals'); use_ok('Devel::REPL::Plugin::CompletionDriver::Methods'); -eval 'use Data::Dump::Concise'; -unless ($@) { - use_ok('Devel::REPL::Plugin::DDC'); -} +eval 'use Data::Dump::Concise; 1' + and use_ok('Devel::REPL::Plugin::DDC'); -eval 'use Data::Dump::Streamer'; -unless ($@) { - use_ok('Devel::REPL::Plugin::DDS'); -} +eval 'use Data::Dump::Streamer; 1' + and use_ok('Devel::REPL::Plugin::DDS'); use_ok('Devel::REPL::Plugin::DumpHistory'); use_ok('Devel::REPL::Plugin::FancyPrompt'); use_ok('Devel::REPL::Plugin::FindVariable'); use_ok('Devel::REPL::Plugin::History'); -eval 'use Sys::SigAction'; -unless ($@) { - use_ok('Devel::REPL::Plugin::Interrupt'); -} +eval 'use Sys::SigAction; 1' + and use_ok('Devel::REPL::Plugin::Interrupt'); # use_ok('Devel::REPL::Plugin::Interrupt') unless $^O eq 'MSWin32'; -eval 'use PPI'; -unless ($@) { - use_ok('Devel::REPL::Plugin::MultiLine::PPI'); -} +eval 'use PPI; 1' + and use_ok('Devel::REPL::Plugin::MultiLine::PPI'); -eval 'use App::Nopaste'; -unless ($@) { - use_ok('Devel::REPL::Plugin::Nopaste'); -} +eval 'use App::Nopaste; 1' + and use_ok('Devel::REPL::Plugin::Nopaste'); use_ok('Devel::REPL::Plugin::OutputCache'); use_ok('Devel::REPL::Plugin::Packages'); use_ok('Devel::REPL::Plugin::Peek'); -eval 'use PPI'; -unless ($@) { - use_ok('Devel::REPL::Plugin::PPI'); -} + +eval 'use PPI; 1' + and use_ok('Devel::REPL::Plugin::PPI'); use_ok('Devel::REPL::Plugin::ReadLineHistory'); -eval 'use Module::Refresh'; -unless ($@) { - use_ok('Devel::REPL::Plugin::Refresh'); -} +eval 'use Module::Refresh; 1' + and use_ok('Devel::REPL::Plugin::Refresh'); use_ok('Devel::REPL::Plugin::ShowClass'); use_ok('Devel::REPL::Plugin::Timing'); diff --git a/t/load_plugins.t b/t/load_plugins.t index 0115c8b..891a72c 100755 --- a/t/load_plugins.t +++ b/t/load_plugins.t @@ -54,16 +54,13 @@ for my $plugin_name (@plugins) { sub test_load_plugin { my ($plugin_name) = @_; my $test_name = "plugin $plugin_name loaded"; - eval "use Devel::REPL::Plugin::$plugin_name"; - unless($@) { - eval { $repl->load_plugin($plugin_name) }; - ok(!$@, $test_name); - } else { - SKIP: { - skip "could not eval plugin $plugin_name", 1; - } + + SKIP: { + eval "use Devel::REPL::Plugin::$plugin_name; 1" + or skip "could not eval plugin $plugin_name", 1; + + ok(eval { $repl->load_plugin($plugin_name); 1 }, $test_name); } } done_testing; -