Sha256: 0b7230cb6698413b719361c35e7b06c4b82252650f7d42062d7e25b8085851ce

Contents?: true

Size: 688 Bytes

Versions: 3

Compression:

Stored size: 688 Bytes

Contents

require 'test_helper'
require 'review/compiler'

class LocationTest < Test::Unit::TestCase
  def setup
  end

  def test_lineno
    f = StringIO.new("a\nb\nc\n")
    location = ReVIEW::Location.new("foo", f)
    assert_equal 0, location.lineno
    f.gets
    assert_equal 1, location.lineno
  end

  def test_string
    location = ReVIEW::Location.new("foo", StringIO.new("a\nb\nc\n"))
    assert_equal "foo:0", location.string
  end

  def test_to_s
    location = ReVIEW::Location.new("foo", StringIO.new("a\nb\nc\n"))
    assert_equal "foo:0", "#{location}"
  end

  def test_to_s_nil
    location = ReVIEW::Location.new("foo", nil)
    assert_equal "foo:nil", "#{location}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
review-2.3.0 test/test_location.rb
review-2.2.0 test/test_location.rb
review-2.1.0 test/test_location.rb