Sha256: c02c917ba42a0e25a0d30203c0d064c41681af6ecfa1076ecc6fe93b173bc3a8

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

require 'test/unit'
require 'bitclust'
require 'bitclust/functionreferenceparser'

class TestFunctionReferenceParser < Test::Unit::TestCase
  def setup
    prefix = 'db'
    src = "test.rd"

    @pwd = Dir.pwd
    Dir.chdir(@tmpdir = Dir.mktmpdir)
    File.open(src, 'w') do |file|
      file.puts <<'HERE'
--- VALUE func()
#@since 2.0.0
some text 1
#@else
some text 2
#@end
HERE
    end
    @path = File.join(@tmpdir, src)
    @db = BitClust::FunctionDatabase.new(prefix)
    @parser = BitClust::FunctionReferenceParser.new(@db)
  end

  def teardown
    Dir.chdir @pwd
    FileUtils.rm_r(@tmpdir, :force => true)
  end

  data("1.9.3" => {
         :version   => "1.9.3",
         :expected  => ["some text 2\n"],
       },
       "2.5.0" => {
         :version   => "2.5.0",
         :expected  => ["some text 1\n"],
       },
       "2.6.0" => {
         :version   => "2.6.0",
         :expected  => ["some text 1\n"],
       })
  def test_parse_file(data)
    @db.transaction {
      result =
        @parser.parse_file(@path, "test.c", {"version" => data[:version]})
      assert_equal data[:expected], result.collect(&:source)
    }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bitclust-core-1.3.0 test/test_functionreferenceparser.rb
bitclust-core-1.2.6 test/test_functionreferenceparser.rb
bitclust-core-1.2.5 test/test_functionreferenceparser.rb
bitclust-core-1.2.4 test/test_functionreferenceparser.rb
bitclust-core-1.2.3 test/test_functionreferenceparser.rb
bitclust-core-1.2.2 test/test_functionreferenceparser.rb