Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:31:05 JST 2016
Kouhei Sutou 2013-04-11 17:25:44 +0900 (Thu, 11 Apr 2013) New Revision: 8618f945c492fcd1bd1ff289dbb98b03d1807ec0 https://github.com/groonga/groonga-command/commit/8618f945c492fcd1bd1ff289dbb98b03d1807ec0 Message: Support conditions when filter parameter is omitted Modified files: lib/groonga/command/select.rb test/command/test-select.rb Modified: lib/groonga/command/select.rb (+2 -2) =================================================================== --- lib/groonga/command/select.rb 2013-04-11 17:24:17 +0900 (edcaedc) +++ lib/groonga/command/select.rb 2013-04-11 17:25:44 +0900 (e28e080) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2012-2013 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -62,7 +62,7 @@ module Groonga private def split_filter_conditions - filter.split(/(?:&&|&!|\|\|)/).collect do |condition| + (filter || "").split(/(?:&&|&!|\|\|)/).collect do |condition| condition = condition.strip condition = condition.gsub(/\A[\s\(]*/, '') condition = condition.gsub(/[\s\)]*\z/, '') unless /\(/ =~ condition Modified: test/command/test-select.rb (+8 -1) =================================================================== --- test/command/test-select.rb 2013-04-11 17:24:17 +0900 (073ea88) +++ test/command/test-select.rb 2013-04-11 17:25:44 +0900 (c72f76b) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2011-2012 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2011-2013 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -56,5 +56,12 @@ class SelectCommandTest < Test::Unit::TestCase 'keyword @ "養殖"'], select.conditions) end + + def test_omitted + select = command(:table => "Users", + :filter => nil) + assert_equal([], + select.conditions) + end end end -------------- next part -------------- HTML����������������������������... Download