diff options
author | Ernie Miller <ernie@metautonomo.us> | 2011-04-29 15:08:27 -0400 |
---|---|---|
committer | Ernie Miller <ernie@metautonomo.us> | 2011-05-02 09:46:29 -0400 |
commit | 13a20317ff820cc37502bdb7296e66c85b74e465 (patch) | |
tree | d3fcbbb3975cf9b76bf6c18266fb47460b60de5f /test/nodes/test_infix_operation.rb | |
parent | a6f56d8b2860a0edd846b94cfe08cdfe61e97e48 (diff) | |
download | rails-13a20317ff820cc37502bdb7296e66c85b74e465.tar.gz rails-13a20317ff820cc37502bdb7296e66c85b74e465.tar.bz2 rails-13a20317ff820cc37502bdb7296e66c85b74e465.zip |
InfixOperations are valid value expressions per SQL99 BNF, and
should support ordering
Diffstat (limited to 'test/nodes/test_infix_operation.rb')
-rw-r--r-- | test/nodes/test_infix_operation.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/nodes/test_infix_operation.rb b/test/nodes/test_infix_operation.rb new file mode 100644 index 0000000000..db3216eeee --- /dev/null +++ b/test/nodes/test_infix_operation.rb @@ -0,0 +1,30 @@ +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 |