Kouhei Sutou
null+****@clear*****
Tue Dec 24 22:44:30 JST 2013
Kouhei Sutou 2013-12-24 22:44:30 +0900 (Tue, 24 Dec 2013) New Revision: f6afb72430c601553c51c3088320d763a9f10a9e https://github.com/ranguba/rroonga/commit/f6afb72430c601553c51c3088320d763a9f10a9e Message: Groonga::Expression#append_operation supports operation name Modified files: ext/groonga/rb-grn-expression.c test/test-expression.rb Modified: ext/groonga/rb-grn-expression.c (+1 -1) =================================================================== --- ext/groonga/rb-grn-expression.c 2013-12-10 22:19:03 +0900 (3582d6f) +++ ext/groonga/rb-grn-expression.c 2013-12-24 22:44:30 +0900 (7444f08) @@ -259,7 +259,7 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation, NULL, NULL, NULL, NULL, NULL); - operation = NUM2INT(rb_operation); + operation = RVAL2GRNOPERATOR(rb_operation); n_arguments = NUM2INT(rb_n_arguments); grn_expr_append_op(context, expression, operation, n_arguments); rb_grn_context_check(context, self); Modified: test/test-expression.rb (+21 -0) =================================================================== --- test/test-expression.rb 2013-12-10 22:19:03 +0900 (4a5e477) +++ test/test-expression.rb 2013-12-24 22:44:30 +0900 (337e1a0) @@ -132,6 +132,27 @@ class ExpressionTest < Test::Unit::TestCase snippet.close end + class AppendOperatorTest < self + setup + def setup_expression + @expression = Groonga::Expression.new + @expression.append_constant(29) + @expression.append_constant(92) + end + + def test_constant + @expression.append_operation(Groonga::Operator::PLUS, 2) + assert_equal("#<Groonga::Expression noname(){229,092,0PLUS}>", + @expression.inspect) + end + + def test_name + @expression.append_operation("plus", 2) + assert_equal("#<Groonga::Expression noname(){229,092,0PLUS}>", + @expression.inspect) + end + end + class VariableTest < self def test_reference expression = Groonga::Expression.new -------------- next part -------------- HTML����������������������������... 다운로드