提交 13a20317 编写于 作者: E Ernie Miller

InfixOperations are valid value expressions per SQL99 BNF, and

should support ordering
上级 a6f56d8b
......@@ -4,6 +4,7 @@ module Nodes
class InfixOperation < Binary
include Arel::Expressions
include Arel::Predications
include Arel::OrderPredications
include Arel::AliasPredication
include Arel::Math
......
require 'helper'
module Arel
module Nodes
class TestInfixOperation < MiniTest::Unit::TestCase
def test_construct
operation = InfixOperation.new :+, 1, 2
assert_equal :+, operation.operator
assert_equal 1, operation.left
assert_equal 2, operation.right
end
def test_operation_alias
operation = InfixOperation.new :+, 1, 2
aliaz = operation.as('zomg')
assert_kind_of As, aliaz
assert_equal operation, aliaz.left
assert_equal 'zomg', aliaz.right
end
def test_opertaion_ordering
operation = InfixOperation.new :+, 1, 2
ordering = operation.desc
assert_kind_of Ordering, ordering
assert_equal operation, ordering.expr
assert_equal :desc, ordering.direction
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册