Sha256: db46d67a20cf3d8e7c5e5633693816c555803ebd919355374bc0cb637827ad4f

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')

describe "Misc" do

  should 'handle accessing #to_sexp after #to_source' do
    (s_proc = lambda { :test }).to_source
    s_proc.should.be having_sexp(s(:iter, s(:call, nil, :proc, s(:arglist)), nil, s(:lit, :test)))
  end

  should 'handle accessing #to_source after #to_sexp' do
    (s_proc = lambda { :test }).to_sexp
    s_proc.should.be having_source('proc { :test }')
  end

  should "handle lexer bug in missing trailing chars after '=>' operator" do
    # This example addresses bug @ http://redmine.ruby-lang.org/issues/show/3765
    {
      __LINE__ => lambda { :test }
    }.values.last.should.be having_source('proc { :test }')
  end

  should "handle lexer bug in missing trailing chars after '=>' operator" do
    # This example addresses bug @ http://redmine.ruby-lang.org/issues/show/3765
    {
      __LINE__ => lambda do :test end
    }.values.last.should.be having_source('proc { :test }')
  end

  unless Object.const_defined?(:ParseTree)
    should "raise Sourcify::CannotParseEvalCodeError when proc is created from eval" do
      lambda { eval("proc {:test }").to_source }.should.
        raise(Sourcify::CannotParseEvalCodeError)
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sourcify-0.3.0 spec/proc/others_spec.rb
sourcify-0.2.3 spec/proc/others_spec.rb
sourcify-0.2.2.1 spec/proc/others_spec.rb
sourcify-0.2.1 spec/proc/others_spec.rb
sourcify-0.2.0 spec/proc/others_spec.rb