Sha256: 8cbdc0d9ceca6ddb60cb6803d2d145ca875ba6f4c4f3bc939e5ad91cbcf08b1f

Contents?: true

Size: 853 Bytes

Versions: 2

Compression:

Stored size: 853 Bytes

Contents

require 'test/unit'
$:.unshift File.expand_path('../../lib', __FILE__)
require 'ctags'

class CtagsTest < Test::Unit::TestCase
  def test_tags_for_file
    tags = Ctags.tags_for_file(__FILE__)
    tag = tags.find{ |t| t[:name] == __method__.to_s }

    assert_equal __FILE__,    tag[:path]
    assert_equal __LINE__-5,  tag[:line]
    assert_equal 'CtagsTest', tag[:class]
    assert_equal 'method',    tag[:kind]
  end

  def test_tags_for_code
    tags = Ctags.tags_for_code('file.rb', File.read(__FILE__))
    tag = tags.find{ |t| t[:name] == __method__.to_s }

    assert_equal 'file.rb',   tag[:path]
    assert_equal __LINE__-5,  tag[:line]
    assert_equal 'CtagsTest', tag[:class]
    assert_equal 'method',    tag[:kind]
  end

  def test_invalid_file
    assert_raises Ctags::Error do
      Ctags.tags_for_file('invalid.rb')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ctags.rb-1.0.15 test/test_ctags.rb
ctags.rb-1.0.6 test/test_ctags.rb