Sha256: 69f893bd78250753aee79587ccf5d849b0322ab13cf48abee5a0048d161d78bc

Contents?: true

Size: 1016 Bytes

Versions: 5

Compression:

Stored size: 1016 Bytes

Contents

require_relative 'helpers'
module Alf
  module Sequel
    describe Compiler do

      def compiler
        @compiler ||= Compiler.new
      end

      subject{ compiler.call(expr) }

      each_query do |query|
        context "Sequel-based SQL compilation of '#{query}'" do
          let(:expr){ conn.parse(query['alf']) }

          it 'to_cog should lead to a Sequel::Cog' do
            expr.to_cog.should be_a(Cog)
          end if query['sql']

          it 'sexpr.to_sql should be valid SQL for the DBMS considered' do
            begin
              sql = expr.to_cog.sexpr.to_sql
              adapter[sql].to_a
            rescue => ex
              $stderr.print('x')
              # $stderr.puts strip(query['sql'])
              # $stderr.puts ex.message
            end
          end if query['sql']

          it 'to_cog.to_a should run without problem' do
            lambda{
              expr.to_cog.to_a
            }.should_not(raise_error)
          end
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.16.3 spec/sql/test_sequel_compiler.rb
alf-0.16.2 spec/sql/test_sequel_compiler.rb
alf-0.16.1 spec/sql/test_sequel_compiler.rb
alf-0.16.0 spec/sql/test_sequel_compiler.rb
alf-0.15.0 spec/sql/test_sequel_compiler.rb