Test blank file

This commit is contained in:
Joshua Peek
2011-06-28 09:26:35 -05:00
parent 0576f1742f
commit 58e99aa5aa
3 changed files with 2 additions and 1 deletions

View File

@@ -308,7 +308,7 @@ module Linguist
# Fail fast if blob isn't viewable?
return unless viewable?
if data && (match = lines[0].match(/(.+)\n?/)) && (bang = match[0]) =~ /^#!/
if lines.any? && (match = lines[0].match(/(.+)\n?/)) && (bang = match[0]) =~ /^#!/
bang.sub!(/^#! /, '#!')
tokens = bang.split(' ')
pieces = tokens.first.split('/')

0
test/fixtures/blank vendored Normal file
View File

View File

@@ -240,6 +240,7 @@ class TestBlob < Test::Unit::TestCase
assert_equal Language['VimL'], blob(".vimrc").language
assert_equal Language['YAML'], blob(".gemrc").language
assert_nil blob("blank").language
assert_nil blob("README").language
# https://github.com/xquery/xprocxq/blob/master/src/xquery/xproc.xqm