summaryrefslogtreecommitdiff
path: root/spec/ruby/core/binding/source_location_spec.rb
blob: d1c8191ea850031ac330542c6c7ccc43003ba4d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require_relative '../../spec_helper'
require_relative 'fixtures/location'

describe "Binding#source_location" do
  it "returns an [file, line] pair" do
    b = BindingSpecs::LocationMethod::TEST_BINDING
    b.source_location.should == [BindingSpecs::LocationMethod::FILE_PATH, 4]
  end

  it "works for eval with a given line" do
    b = eval('binding', nil, "foo", 100)
    b.source_location.should == ["foo", 100]
  end
end