mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Testing Vim modeline support
This commit is contained in:
3
test/fixtures/Data/Modelines/not_perl.pl
vendored
Normal file
3
test/fixtures/Data/Modelines/not_perl.pl
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* vim: set filetype=prolog: */
|
||||||
|
|
||||||
|
# I am Prolog
|
||||||
3
test/fixtures/Data/Modelines/ruby
vendored
Normal file
3
test/fixtures/Data/Modelines/ruby
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* vim: set filetype=ruby: */
|
||||||
|
|
||||||
|
# I am Ruby
|
||||||
3
test/fixtures/Data/Modelines/seeplusplus
vendored
Normal file
3
test/fixtures/Data/Modelines/seeplusplus
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* vim: set ft=cpp: */
|
||||||
|
|
||||||
|
I would like to be C++ please.
|
||||||
20
test/test_modelines.rb
Normal file
20
test/test_modelines.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
require_relative "./helper"
|
||||||
|
|
||||||
|
class TestModelines < Minitest::Test
|
||||||
|
include Linguist
|
||||||
|
|
||||||
|
def fixtures_path
|
||||||
|
File.expand_path("../fixtures", __FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def fixture_blob(name)
|
||||||
|
name = File.join(fixtures_path, name) unless name =~ /^\//
|
||||||
|
FileBlob.new(name, fixtures_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_modelines
|
||||||
|
assert_equal Language["Ruby"], fixture_blob("Data/Modelines/ruby").language
|
||||||
|
assert_equal Language["C++"], fixture_blob("Data/Modelines/seeplusplus").language
|
||||||
|
assert_equal Language["Prolog"], fixture_blob("Data/Modelines/not_perl.pl").language
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user