[Groonga-commit] droonga/drntest at 81e3b65 [master] Load options in included files

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Nov 26 16:09:50 JST 2013


YUKI Hiroshi	2013-11-26 16:09:50 +0900 (Tue, 26 Nov 2013)

  New Revision: 81e3b6586f1abd20e5fddc54ebc454dea6d438cf
  https://github.com/droonga/drntest/commit/81e3b6586f1abd20e5fddc54ebc454dea6d438cf

  Message:
    Load options in included files

  Modified files:
    lib/drntest/test-runner.rb

  Modified: lib/drntest/test-runner.rb (+16 -5)
===================================================================
--- lib/drntest/test-runner.rb    2013-11-26 15:57:59 +0900 (ee4389b)
+++ lib/drntest/test-runner.rb    2013-11-26 16:09:50 +0900 (c52a344)
@@ -28,7 +28,7 @@ module Drntest
     def initialize(owner, target)
       @owner = owner
       @target_path = Pathname(target)
-      @options = load_options
+      @options = load_options(target)
     end
 
     def run
@@ -192,13 +192,24 @@ module Drntest
       results
     end
 
-    def load_options
+    def load_options(path, options={})
       options = {}
-      @target_path.read.each_line do |line|
+      Pathname(path).read.each_line do |line|
         next unless /\A\#\@([^\s]+)\s+(.+)\n?\z/ =~ line
         key = $1.to_sym
-        options[key] ||= []
-        options[key] << $2
+        value = $2
+        if key == :include
+          included = resolve_relative_path(value, options[:base_path] || base_path)
+          included_options = load_options(included,
+                                          options.merge(:base_path => included))
+          included_options.each do |key, values|
+            options[key] ||= []
+            options[key] += values
+          end
+        else
+          options[key] ||= []
+          options[key] << value
+        end
       end
       options
     end
-------------- next part --------------
HTML����������������������������...
Download 



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