YUKI Hiroshi
null+****@clear*****
Thu Sep 26 12:30:22 JST 2013
YUKI Hiroshi 2013-09-26 12:30:22 +0900 (Thu, 26 Sep 2013) New Revision: 5dcb42e679f0f9e1edfa18348b4bea2b52392bab https://github.com/droonga/drntest/commit/5dcb42e679f0f9e1edfa18348b4bea2b52392bab Message: Accept "--testcase" option to filter running tests Modified files: lib/drntest/tester.rb Modified: lib/drntest/tester.rb (+21 -1) =================================================================== --- lib/drntest/tester.rb 2013-09-25 15:54:54 +0900 (4d13e0e) +++ lib/drntest/tester.rb 2013-09-26 12:30:22 +0900 (fe1befd) @@ -37,16 +37,22 @@ module Drntest tester.tag = tag end + parser.on("--testcase=PATTERN", + "Run only testcases which have a name matched to the given PATTERN") do |pattern| + tester.pattern = pattern + end + parser end end - attr_accessor :port, :host, :tag + attr_accessor :port, :host, :tag, :pattern def initialize @port = 24224 @host = "localhost" @tag = "droonga" + @pattern = nil end def run(*targets) @@ -84,6 +90,20 @@ module Drntest tests << target_path end end + + unles****@patte*****? + if @pattern =~ /\A\/.+\/\z/ + matcher = Regexp.new(@pattern[1..-2]) + tests.select! do |test| + test.basename(".test").to_s =~ matcher + end + else + tests.select! do |test| + test.basename(".test").to_s == @pattern + end + end + end + tests end end -------------- next part -------------- HTML����������������������������...Download