YUKI Hiroshi
null+****@clear*****
Thu Nov 28 18:55:36 JST 2013
YUKI Hiroshi 2013-11-28 18:55:36 +0900 (Thu, 28 Nov 2013) New Revision: b42a44ca96c12230a273d85be6c62961ad3cf999 https://github.com/droonga/drntest/commit/b42a44ca96c12230a273d85be6c62961ad3cf999 Message: Add "--test-suite" option to run tests in specified directory Modified files: lib/drntest/tester.rb Modified: lib/drntest/tester.rb (+20 -5) =================================================================== --- lib/drntest/tester.rb 2013-11-28 18:39:07 +0900 (8145438) +++ lib/drntest/tester.rb 2013-11-28 18:55:36 +0900 (631e34a) @@ -85,7 +85,15 @@ module Drntest if /\A\/(.+)\/\z/ =~ pattern pattern = Regexp.new($1) end - tester.pattern = pattern + tester.test_pattern = pattern + end + + parser.on("--test-suite=PATTERN", + "Run only test suites which have a path matched to the given PATTERN") do |pattern| + if /\A\/(.+)\/\z/ =~ pattern + pattern = Regexp.new($1) + end + tester.suite_pattern = pattern end parser @@ -93,7 +101,7 @@ module Drntest end attr_accessor :port, :host, :tag, :fluentd, :fluentd_options - attr_accessor :pattern, :base_path, :config + attr_accessor :test_pattern, :suite_pattern, :base_path, :config def initialize @port = 24224 @@ -103,7 +111,8 @@ module Drntest @config = "default" @fluentd = "fluentd" @fluentd_options = [] - @pattern = nil + @test_pattern = nil + @suite_pattern = nil end def run(*targets) @@ -142,9 +151,15 @@ module Drntest end end - unles****@patte*****? + unless @test_pattern.nil? + tests.select! do |test| + @test_pattern === test.basename(".test").to_s + end + end + + unless @suite_pattern.nil? tests.select! do |test| - @pattern === test.basename(".test").to_s + @suite_pattern === test.dirname.to_s.sub(@base_path.to_s, "") end end -------------- next part -------------- HTML����������������������������...Download