Remove pathname

Closes #207
This commit is contained in:
Joshua Peek
2012-07-23 16:50:30 -05:00
parent bacfd4e832
commit 6ac9138aed
5 changed files with 6 additions and 172 deletions

View File

@@ -29,10 +29,6 @@ class TestBlob < Test::Unit::TestCase
assert_equal "foo.rb", blob("foo.rb").name
end
def test_pathname
assert_equal Pathname.new("foo.rb"), blob("foo.rb").pathname
end
def test_mime_type
assert_equal "application/octet-stream", blob("Binary/dog.o").mime_type
assert_equal "application/ogg", blob("Binary/foo.ogg").mime_type

View File

@@ -1,62 +0,0 @@
require 'linguist/pathname'
require 'test/unit'
require 'pygments'
class TestPathname < Test::Unit::TestCase
include Linguist
Lexer = Pygments::Lexer
def test_to_s
assert_equal "file.rb", Pathname.new("file.rb").to_s
end
def test_basename
assert_equal 'file.rb', Pathname.new("file.rb").basename
assert_equal 'file.rb', Pathname.new("./file.rb").basename
assert_equal 'file.rb', Pathname.new("sub/dir/file.rb").basename
assert_equal '.profile', Pathname.new(".profile").basename
end
def test_extname
assert_equal '.rb', Pathname.new("file.rb").extname
assert_equal '.rb', Pathname.new("./file.rb").extname
assert_equal '.rb', Pathname.new("sub/dir/file.rb").extname
assert_equal '', Pathname.new(".profile").extname
end
def test_language
assert_nil Pathname.new(".rb").language
assert_equal Language['Ruby'], Pathname.new("file.rb").language
assert_equal Language['Ruby'], Pathname.new("./file.rb").language
assert_equal Language['Ruby'], Pathname.new("sub/dir/file.rb").language
assert_equal Language['Ruby'], Pathname.new("Rakefile").language
assert_equal Language['Ruby'], Pathname.new("vendor/Rakefile").language
assert_equal Language['Ruby'], Pathname.new("./Rakefile").language
assert_equal Language['Gentoo Ebuild'], Pathname.new("file.ebuild").language
assert_equal Language['Python'], Pathname.new("itty.py").language
assert_equal Language['Nu'], Pathname.new("itty.nu").language
assert_nil Pathname.new("defu.nkt").language
end
def test_lexer
assert_equal Lexer['Ruby'], Pathname.new("file.rb").lexer
assert_equal Lexer['Ruby'], Pathname.new("Rakefile").lexer
assert_equal Lexer['Bash'], Pathname.new("file.ebuild").lexer
assert_equal Lexer['Python'], Pathname.new("itty.py").lexer
assert_equal Lexer['Scheme'], Pathname.new("itty.nu").lexer
assert_equal Lexer['Text only'], Pathname.new("defu.nkt").lexer
end
def test_mime_type
assert_equal 'application/x-ruby', Pathname.new("file.rb").mime_type
assert_equal 'application/javascript', Pathname.new("file.js").mime_type
assert_equal 'application/x-python', Pathname.new("itty.py").mime_type
assert_equal 'text/plain', Pathname.new("defu.nkt").mime_type
end
end