Jelajahi Sumber

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 4 tahun lalu
induk
melakukan
cf4a086af3
1 mengubah file dengan 10 tambahan dan 5 penghapusan
  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' ) {