mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Tests for Generated.generated? optimization
This commit is contained in:
40
test/test_generated.rb
Normal file
40
test/test_generated.rb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
class TestGenerated < Test::Unit::TestCase
|
||||||
|
include Linguist
|
||||||
|
|
||||||
|
def samples_path
|
||||||
|
File.expand_path("../../samples", __FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def generated_without_loading_data(name)
|
||||||
|
blob = File.join(samples_path, name)
|
||||||
|
Generated.generated?(blob, lambda { false })
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_generated_without_loading_data
|
||||||
|
# Xcode project files
|
||||||
|
assert generated_without_loading_data("Binary/MainMenu.nib")
|
||||||
|
assert generated_without_loading_data("Dummy/foo.xcworkspacedata")
|
||||||
|
assert generated_without_loading_data("Dummy/foo.xcuserstate")
|
||||||
|
|
||||||
|
# .NET designer file
|
||||||
|
assert generated_without_loading_data("Dummu/foo.designer.cs")
|
||||||
|
|
||||||
|
# Composer generated composer.lock file
|
||||||
|
assert generated_without_loading_data("JSON/composer.lock")
|
||||||
|
|
||||||
|
# Node modules
|
||||||
|
assert generated_without_loading_data("Dummy/node_modules/foo.js")
|
||||||
|
|
||||||
|
# Godep saved dependencies
|
||||||
|
assert generated_without_loading_data("Godeps/Godeps.json")
|
||||||
|
assert generated_without_loading_data("Godeps/_workspace/src/github.com/kr/s3/sign.go")
|
||||||
|
|
||||||
|
# Generated by Zephir
|
||||||
|
assert generated_without_loading_data("Zephir/filenames/exception.zep.c")
|
||||||
|
assert generated_without_loading_data("Zephir/filenames/exception.zep.h")
|
||||||
|
assert generated_without_loading_data("Zephir/filenames/exception.zep.php")
|
||||||
|
|
||||||
|
# Minified files
|
||||||
|
assert !generated_without_loading_data("JavaScript/jquery-1.6.1.min.js")
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user