Explorar el Código

Added new test that will check to see that all commands are implemented

Gordon Child hace 14 años
padre
commit
e67717c594
Se han modificado 2 ficheros con 36 adiciones y 0 borrados
  1. 1 0
      MANIFEST
  2. 35 0
      t/04-commands-implemented.t

+ 1 - 0
MANIFEST

@@ -11,6 +11,7 @@ t/00-load.t
 t/01-driver-live.t
 t/02-webelement-live.t
 t/03-spec-coverage.t
+t/04-commands-implemented.t
 t/http-server.pl
 inc/Module/AutoInstall.pm
 inc/Module/Install/AutoInstall.pm

+ 35 - 0
t/04-commands-implemented.t

@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use Selenium::Remote::Commands;
+use Test::More;
+
+unless($ENV{RELEASE_TESTING}) {
+  plan(skip_all=>"Author tests not required for installation.");
+}
+
+my $comm = Selenium::Remote::Commands->new;
+for my $command (keys %{$comm}) {
+  my $found_command = 0;
+  for my $file (
+    qw{lib/Selenium/Remote/Driver.pm
+    lib/Selenium/Remote/WebElement.pm}
+    ) {
+    open(my $fh, '<', $file) or die "Couldn't open file $file";
+    for (<$fh>) {
+      if (/'?command'?\s*=>\s*'$command'/
+       or /{'?commands'?}->{'?$command'?}/) {
+        pass("find $command");
+        $found_command = 1;
+      }
+    }
+  }
+  if (!$found_command) {
+    fail("find $command");
+  }
+}
+
+done_testing;
+
+1;