Explorar o código

Issue #335: Use $method for the generic test name,

as $method is no longer changed in the sub.
Slightly nicer formatting of the generic test name.
bernhard %!s(int64=4) %!d(string=hai) anos
pai
achega
cf4a086af3
Modificáronse 1 ficheiros con 10 adicións e 5 borrados
  1. 10 5
      lib/Test/Selenium/Remote/Role/DoesTesting.pm

+ 10 - 5
lib/Test/Selenium/Remote/Role/DoesTesting.pm

@@ -114,11 +114,16 @@ sub _check_ok {
         }
     };
 
-    my $default_test_name = $method;
-    $default_test_name .= "'" . join( "' ", @r_args ) . "'"
-      if $num_of_args > 0;
-
-    my $test_name = pop @args // $default_test_name;
+    # test description might have been explicitly passed
+    my $test_name = pop @args;
+
+    # generic test description when no explicit test description was passed
+    if ( ! defined $test_name ) {
+        $test_name = $num_of_args  > 0 ?
+            join( ' ', $method, map { q{'$_'} } @r_args )
+            :
+            $method;
+    }
 
     # case when find_no_element found an element, we should croak
     if ( $method eq 'find_no_element' ) {