Sha256: 22c353513ee98426a298ab05eff5125d2cecfc14dde810ff2abd3a4504aec84b
Contents?: true
Size: 925 Bytes
Versions: 1
Compression:
Stored size: 925 Bytes
Contents
require 'spec_helper' describe Kl::Reader do def reader(str) Kl::Reader.new(StringIO.new(str)) end describe 'Reading lists' do it 'reads () as an empty list' do reader('()').next.should be_kind_of Kl::EmptyList end it 'reads a list as a single expression' do list = reader('(1 2 3)').next list.should == Kl::Cons.list([1, 2, 3]) end it 'supports nested lists' do list = reader('(1 (2 (3) ()))').next list.should == Kl::Cons.list([1, Kl::Cons.list([2, Kl::Cons.list([3]), Kl::EmptyList.instance])]) end end describe 'Reading booleans' do it 'reads true as true' do reader('true').next.should == true end it 'reads false as false' do reader('false').next.should == false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shen-ruby-0.1.0 | spec/kl/reader_spec.rb |