Prechádzať zdrojové kódy

Fix #143: Don't append plan information to output if we don't have any

George S. Baugh 7 rokov pred
rodič
commit
46cecdd12f
4 zmenil súbory, kde vykonal 20 pridanie a 4 odobranie
  1. 3 0
      Changes
  2. 1 1
      dist.ini
  3. 1 1
      lib/Test/Rail/Parser.pm
  4. 15 2
      t/Test-Rail-Parser.t

+ 3 - 0
Changes

@@ -1,5 +1,8 @@
 Revision history for Perl module TestRail::API
 
+0.042 2018-04-30 TEODESIAN
+    - Fix uninitialized value warning when no plan is emitted
+
 0.041 2017-06-06 TEODESIAN
     - Fix MCE usage issue with confusion based on array -> hash inputs in TestRail::Utils::Find
     - Fix issue where Test plans were not recorded in the raw output of a case.

+ 1 - 1
dist.ini

@@ -1,6 +1,6 @@
 name = TestRail-API
 main_module = lib/TestRail/API.pm
-version = 0.041
+version = 0.042
 author = George S. Baugh <teodesian@cpan.org>
 license = Perl_5
 copyright_holder = George S. Baugh

+ 1 - 1
lib/Test/Rail/Parser.pm

@@ -584,7 +584,7 @@ Used to record test planning messages.
 sub planCallback {
     my ($plan) = @_;
     my $self = $plan->{'parser'};
-    $self->{raw_output} .= $plan->as_string;
+    $self->{raw_output} .= $plan->as_string if $plan->as_string;
 }
 
 sub _set_result {

+ 15 - 2
t/Test-Rail-Parser.t

@@ -10,10 +10,10 @@ use Scalar::Util qw{reftype};
 use TestRail::API;
 use Test::LWP::UserAgent::TestRailMock;
 use Test::Rail::Parser;
-use Test::More 'tests' => 124;
+use Test::More 'tests' => 125;
 use Test::Fatal qw{exception};
 use Test::Deep qw{cmp_deeply};
-use Capture::Tiny qw{capture};
+use Capture::Tiny qw{capture capture_stderr};
 
 #Same song and dance as in TestRail-API.t
 my $apiurl = $ENV{'TESTRAIL_API_URL'};
@@ -591,3 +591,16 @@ $opts->{'sections'} = [];
 
 $res = exception { $tap = Test::Rail::Parser->new($opts) };
 is($res,undef,"TR Parser runs all the way through when spawning configurations");
+
+$fcontents = "
+todo_pass.test ..
+ok 1 - STORAGE TANKS SEARED #TODO todo pass
+# goo
+Bail out!  #YOLO
+";
+undef $opts->{'source'};
+$opts->{'tap'} = $fcontents;
+
+#Issue 143
+my $warns = capture_stderr { $tap = Test::Rail::Parser->new($opts) };
+is($warns, '', "No warnings parsing TAP with undef plans");