mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user