[Groonga-commit] droonga/drntest at 199c1c0 [master] Add "subscribe-until" directive

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 14 19:42:59 JST 2015


YUKI Hiroshi	2015-04-14 19:42:59 +0900 (Tue, 14 Apr 2015)

  New Revision: 199c1c06ce31861ff3c9a1d15e7133287cb12bf4
  https://github.com/droonga/drntest/commit/199c1c06ce31861ff3c9a1d15e7133287cb12bf4

  Message:
    Add "subscribe-until" directive

  Modified files:
    lib/drntest/directive.rb
    lib/drntest/test-loader.rb

  Modified: lib/drntest/directive.rb (+21 -0)
===================================================================
--- lib/drntest/directive.rb    2015-04-14 19:26:25 +0900 (732a397)
+++ lib/drntest/directive.rb    2015-04-14 19:42:59 +0900 (a166469)
@@ -67,4 +67,25 @@ module Drntest
 
   class DisableValidationDirective < Directive
   end
+
+  class SubscribeUntil < Directive
+    attr_reader :timeout_seconds
+
+    DEFAULT_TIMEOUT_SECONDS = 1
+
+    ONE_MINUTE_IN_SECONDS = 60
+    ONE_HOUR_IN_SECONDS = ONE_MINUTE_IN_SECONDS * 60
+
+    def initialize(timeout)
+      if timeout =~ /\A(\d+\.?|\.\d+|\d+\.\d+)s(?:ec(?:onds?)?)?\z/
+        @timeout_seconds = $1.to_f
+      elsif timeout =~ /\A(\d+\.?|\.\d+|\d+\.\d+)m(?:inutes?)?\z/
+        @timeout_seconds = $1.to_f * ONE_MINUTE_IN_SECONDS
+      elsif timeout =~ /\A(\d+\.?|\.\d+|\d+\.\d+)h(?:ours?)?\z/
+        @timeout_seconds = $1.to_f * ONE_HOUR_IN_SECONDS
+      else
+        @timeout_seconds = DEFAULT_TIMEOUT_SECONDS
+      end
+    end
+  end
 end

  Modified: lib/drntest/test-loader.rb (+2 -0)
===================================================================
--- lib/drntest/test-loader.rb    2015-04-14 19:26:25 +0900 (30966ce)
+++ lib/drntest/test-loader.rb    2015-04-14 19:42:59 +0900 (8f04eb6)
@@ -99,6 +99,8 @@ module Drntest
         EnableValidationDirective.new
       when :disable_validation
         DisableValidationDirective.new
+      when :subscribe_until
+        SubscribeUntil.new(options.first)
       else
         UnknownDirective.new(type, options)
       end
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index