Sha256: efe7424a4698963fa7305e49280bfa0da9afc7c9f80ba94a2fa574e196eebe44
Contents?: true
Size: 883 Bytes
Versions: 5
Compression:
Stored size: 883 Bytes
Contents
require 'spec_helper' require 'dentaku/ast/combinators' require 'dentaku/token' describe Dentaku::AST::And do let(:t) { Dentaku::AST::Logical.new Dentaku::Token.new(:logical, true) } let(:f) { Dentaku::AST::Logical.new Dentaku::Token.new(:logical, false) } let(:five) { Dentaku::AST::Numeric.new Dentaku::Token.new(:numeric, 5) } it 'performs logical AND' do node = described_class.new(t, f) expect(node.value).to eq false end it 'requires logical operands' do expect { described_class.new(t, five) }.to raise_error(Dentaku::ParseError, /requires logical operands/) expression = Dentaku::AST::LessThanOrEqual.new(five, five) expect { described_class.new(t, expression) }.not_to raise_error expression = Dentaku::AST::Or.new(t, f) expect { described_class.new(t, expression) }.not_to raise_error end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
dentaku-2.0.11 | spec/ast/and_spec.rb |
dentaku-2.0.10 | spec/ast/and_spec.rb |
dentaku-2.0.9 | spec/ast/and_spec.rb |
dentaku-2.0.8 | spec/ast/and_spec.rb |
dentaku-2.0.7 | spec/ast/and_spec.rb |