Sha256: b14eee9d4120f3dae77b96dd6e07f2237cdf0f991994c3ca7114c7051db581ac
Contents?: true
Size: 904 Bytes
Versions: 1
Compression:
Stored size: 904 Bytes
Contents
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'comp' do subject{ Factory.comp(:eq, h) } context "when the hash is empty" do let(:h){ {} } it{ should eq(Factory.tautology) } end context "when the hash is singleton" do let(:h){ {:x => 12, :y => :z} } let(:expected){ [:and, [:eq, [:identifier, :x], [:literal, 12]], [:eq, [:identifier, :y], [:identifier, :z]]] } it_should_behave_like "a predicate AST node" it{ should be_a(And) } it{ should eq(expected) } end context "when the hash is not singelton" do let(:h){ {:x => 12} } it_should_behave_like "a predicate AST node" it{ should be_a(Eq) } it{ should eq([:eq, [:identifier, :x], [:literal, 12]]) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.15.0 | spec/unit/alf-predicate/factory/test_comp.rb |