Sha256: a08ccd1fc60c26ba51d11858795ccd7a8652684e19b0a1ad8d7e646302898b45

Contents?: true

Size: 1.58 KB

Versions: 499

Compression:

Stored size: 1.58 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '../../../test_helper')
require 'rbbt/resource/path'
require 'rbbt/util/tmpfile'
require 'test/unit'

class TestTSV < Test::Unit::TestCase

  def test_find
    name = 'test_name_for_unexistent_file'
    path = Path.setup "tmp/#{ name }"

    TmpFile.with_file do |dir|
      assert File.join(ENV['HOME'], path), path.find(nil, nil, {:root => File.join(dir, '{TOPLEVEL}/{SUBPATH}'), :default => :user, :user => File.join(ENV['HOME'], "{TOPLEVEL}", "{SUBPATH}")})
      FileUtils.mkdir_p File.dirname(File.join(dir, path))
      FileUtils.touch File.join(dir, path)
      assert File.join(dir, "tmp/test"), path.find(nil, nil, {:root => File.join(dir, '{TOPLEVEL}/{SUBPATH}'), :default => :user, :user => File.join(ENV['HOME'], "{TOPLEVEL}", "{SUBPATH}")})
    end
  end

  def test_prev
    path = Path.setup "/tmp"
    assert_equal "/tmp/bar/foo", path.foo("bar")
  end

  def test_doc_file
    path = Path.setup "lib/rbbt/resource.rb"
    assert_equal File.join('doc', path), path.doc_file
    assert_equal Path.setup(File.join('doc', path)).find(:lib), path.find(:lib).doc_file

    assert_equal "lib/rbbt/resource.rb", path.doc_file.source_for_doc_file
    assert_equal path.find, path.doc_file.find(:lib).source_for_doc_file
    assert_equal path.find, path.doc_file.source_for_doc_file.find

    assert_equal "doc/lib/rbbt/resource.doc", path.doc_file.set_extension('doc')
    assert_equal "lib/rbbt/resource.rb", path.doc_file.set_extension('doc').source_for_doc_file

    assert_equal "doc/lib/rbbt/resource.doc", path.doc_file.set_extension('doc')
  end
end

Version data entries

499 entries across 499 versions & 1 rubygems

Version Path
rbbt-util-5.22.4 test/rbbt/resource/test_path.rb
rbbt-util-5.22.3 test/rbbt/resource/test_path.rb
rbbt-util-5.22.1 test/rbbt/resource/test_path.rb
rbbt-util-5.22.0 test/rbbt/resource/test_path.rb
rbbt-util-5.21.137 test/rbbt/resource/test_path.rb
rbbt-util-5.21.136 test/rbbt/resource/test_path.rb
rbbt-util-5.21.135 test/rbbt/resource/test_path.rb
rbbt-util-5.21.134 test/rbbt/resource/test_path.rb
rbbt-util-5.21.133 test/rbbt/resource/test_path.rb
rbbt-util-5.21.132 test/rbbt/resource/test_path.rb
rbbt-util-5.21.131 test/rbbt/resource/test_path.rb
rbbt-util-5.21.130 test/rbbt/resource/test_path.rb
rbbt-util-5.21.129 test/rbbt/resource/test_path.rb
rbbt-util-5.21.128 test/rbbt/resource/test_path.rb
rbbt-util-5.21.127 test/rbbt/resource/test_path.rb
rbbt-util-5.21.126 test/rbbt/resource/test_path.rb
rbbt-util-5.21.125 test/rbbt/resource/test_path.rb
rbbt-util-5.21.123 test/rbbt/resource/test_path.rb
rbbt-util-5.21.122 test/rbbt/resource/test_path.rb
rbbt-util-5.21.121 test/rbbt/resource/test_path.rb