Testing Vim modeline support

This commit is contained in:
Arfon Smith
2015-01-26 14:39:07 -06:00
parent e536eea5b6
commit 429c791377
4 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
/* vim: set filetype=prolog: */
# I am Prolog

3
test/fixtures/Data/Modelines/ruby vendored Normal file
View File

@@ -0,0 +1,3 @@
/* vim: set filetype=ruby: */
# I am Ruby

View File

@@ -0,0 +1,3 @@
/* vim: set ft=cpp: */
I would like to be C++ please.

20
test/test_modelines.rb Normal file
View 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