1
0
Fork 0
mirror of synced 2024-11-27 03:05:36 -05:00
ultimate-vim/sources_non_forked/vim-node/test/ftdetect_test.rb

46 lines
1.2 KiB
Ruby
Raw Normal View History

2014-06-13 09:52:19 -04:00
require_relative "./helper"
describe "Ftdetect" do
[
"#!/usr/bin/env node",
"#!/usr/bin/env node --harmony-generators",
"#!/usr/local/bin/env node",
"#!/usr/local/bin/env node --harmony-generators",
"#!/usr/bin/node",
"#!/usr/bin/node --harmony-generators",
"#!/usr/local/bin/node",
"#!/usr/local/bin/node --harmony-generators",
].each do |shebang|
it %(must detect a file with "#{shebang}" shebang as JavaScript) do
file = Tempfile.new("bang")
file.write shebang + $/
file.close
$vim.edit file.path
$vim.echo("&ft").must_equal "javascript"
end
end
[
"#!/usr/bin/env noder",
"#!/usr/bin/noder",
].each do |shebang|
it %(must not detect a file with "#{shebang}" shebang as JavaScript) do
file = Tempfile.new("bang")
file.write shebang + $/
file.close
$vim.edit file.path
$vim.echo("&ft").wont_equal "javascript"
end
end
it "must not detect a .c file as JavaScript even with Node's shebang" do
file = Tempfile.new(%w[tea .c])
file.write "#!/usr/bin/node" + $/
file.close
$vim.edit file.path
$vim.echo("&ft").wont_equal "javascript"
end
end