Sha256: 10ccaedf39836649a460fb4f750880d52d7d7a61e5857a16e00d665d461c171c

Contents?: true

Size: 848 Bytes

Versions: 3

Compression:

Stored size: 848 Bytes

Contents

require 'spec_helper'

describe AQL::Node::Literal::Composed::List, '.constant' do
  let(:object) { described_class }

  subject { object.construct(input) }

  context 'with empty input' do
    let(:input) { [] }

    it { should eql(described_class.new([])) }
  end

  context 'with scalar values as input' do
    let(:input) { [1, 2] }

    it 'should return correct ast' do
      should eql(described_class.new([
        AQL::Node::Literal::Primitive::Number.new(1),
        AQL::Node::Literal::Primitive::Number.new(2)
      ]))
    end

  end

  context 'with nested scalar values as input' do
    let(:input) { [1, [2] ] }

    it 'should return correct ast' do
      should eql(described_class.new([
        AQL::Node::Literal::Primitive::Number.new(1),
        AQL::Node::Literal::Composed::List.construct([2])
      ]))
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aql-0.0.3 spec/unit/aql/node/literal/composed/list/class_methods/construct_spec.rb
aql-0.0.2 spec/unit/aql/node/literal/composed/list/class_methods/construct_spec.rb
aql-0.0.1 spec/unit/aql/node/literal/composed/list/class_methods/construct_spec.rb