mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Simplify blob tests
Now that FileBlobs with relative paths can still access their files on disk, we can use relative paths for all FileBlobs in the test. This more closely matches the behavior in github.com's codebase, where all blobs use relative paths.
This commit is contained in:
@@ -22,22 +22,14 @@ class TestBlob < Minitest::Test
|
|||||||
File.expand_path("../fixtures", __FILE__)
|
File.expand_path("../fixtures", __FILE__)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sample_blob(name, enforce_relative = false)
|
def sample_blob(name)
|
||||||
name = File.join(samples_path, name) unless name =~ /^\//
|
name = File.join(samples_path, name) unless name =~ /^\//
|
||||||
if enforce_relative
|
|
||||||
FileBlob.new(name, samples_path)
|
FileBlob.new(name, samples_path)
|
||||||
else
|
|
||||||
FileBlob.new(name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def fixture_blob(name, enforce_relative = false)
|
def fixture_blob(name)
|
||||||
name = File.join(fixtures_path, name) unless name =~ /^\//
|
name = File.join(fixtures_path, name) unless name =~ /^\//
|
||||||
if enforce_relative
|
|
||||||
FileBlob.new(name, fixtures_path)
|
FileBlob.new(name, fixtures_path)
|
||||||
else
|
|
||||||
FileBlob.new(name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def script_blob(name)
|
def script_blob(name)
|
||||||
@@ -271,7 +263,7 @@ class TestBlob < Minitest::Test
|
|||||||
assert !sample_blob("ext/extconf.rb").vendored?
|
assert !sample_blob("ext/extconf.rb").vendored?
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
assert sample_blob("dependencies/windows/headers/GL/glext.h", true).vendored?
|
assert sample_blob("dependencies/windows/headers/GL/glext.h").vendored?
|
||||||
|
|
||||||
# Node dependencies
|
# Node dependencies
|
||||||
assert sample_blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
|
assert sample_blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
|
||||||
@@ -296,10 +288,10 @@ class TestBlob < Minitest::Test
|
|||||||
assert sample_blob("external/jquery.min.js").vendored?
|
assert sample_blob("external/jquery.min.js").vendored?
|
||||||
|
|
||||||
# C deps
|
# C deps
|
||||||
assert sample_blob("deps/http_parser/http_parser.c", true).vendored?
|
assert sample_blob("deps/http_parser/http_parser.c").vendored?
|
||||||
assert sample_blob("deps/v8/src/v8.h", true).vendored?
|
assert sample_blob("deps/v8/src/v8.h").vendored?
|
||||||
|
|
||||||
assert sample_blob("tools/something/else.c", true).vendored?
|
assert sample_blob("tools/something/else.c").vendored?
|
||||||
|
|
||||||
# Chart.js
|
# Chart.js
|
||||||
assert sample_blob("some/vendored/path/Chart.js").vendored?
|
assert sample_blob("some/vendored/path/Chart.js").vendored?
|
||||||
@@ -309,10 +301,10 @@ class TestBlob < Minitest::Test
|
|||||||
assert sample_blob("codemirror/mode/blah.js").vendored?
|
assert sample_blob("codemirror/mode/blah.js").vendored?
|
||||||
|
|
||||||
# Debian packaging
|
# Debian packaging
|
||||||
assert sample_blob("debian/cron.d", true).vendored?
|
assert sample_blob("debian/cron.d").vendored?
|
||||||
|
|
||||||
# Erlang
|
# Erlang
|
||||||
assert sample_blob("rebar", true).vendored?
|
assert sample_blob("rebar").vendored?
|
||||||
|
|
||||||
# Minified JavaScript and CSS
|
# Minified JavaScript and CSS
|
||||||
assert sample_blob("foo.min.js").vendored?
|
assert sample_blob("foo.min.js").vendored?
|
||||||
@@ -323,7 +315,7 @@ class TestBlob < Minitest::Test
|
|||||||
assert !sample_blob("foo.min.txt").vendored?
|
assert !sample_blob("foo.min.txt").vendored?
|
||||||
|
|
||||||
#.osx
|
#.osx
|
||||||
assert sample_blob(".osx", true).vendored?
|
assert sample_blob(".osx").vendored?
|
||||||
|
|
||||||
# Prototype
|
# Prototype
|
||||||
assert !sample_blob("public/javascripts/application.js").vendored?
|
assert !sample_blob("public/javascripts/application.js").vendored?
|
||||||
@@ -333,7 +325,7 @@ class TestBlob < Minitest::Test
|
|||||||
assert sample_blob("public/javascripts/dragdrop.js").vendored?
|
assert sample_blob("public/javascripts/dragdrop.js").vendored?
|
||||||
|
|
||||||
# Samples
|
# Samples
|
||||||
assert sample_blob("Samples/Ruby/foo.rb", true).vendored?
|
assert sample_blob("Samples/Ruby/foo.rb").vendored?
|
||||||
|
|
||||||
# jQuery
|
# jQuery
|
||||||
assert sample_blob("jquery.js").vendored?
|
assert sample_blob("jquery.js").vendored?
|
||||||
@@ -398,10 +390,10 @@ class TestBlob < Minitest::Test
|
|||||||
assert sample_blob("public/javascripts/modernizr.custom.01009.js").vendored?
|
assert sample_blob("public/javascripts/modernizr.custom.01009.js").vendored?
|
||||||
|
|
||||||
# Fabric
|
# Fabric
|
||||||
assert sample_blob("fabfile.py", true).vendored?
|
assert sample_blob("fabfile.py").vendored?
|
||||||
|
|
||||||
# WAF
|
# WAF
|
||||||
assert sample_blob("waf", true).vendored?
|
assert sample_blob("waf").vendored?
|
||||||
|
|
||||||
# Visual Studio IntelliSense
|
# Visual Studio IntelliSense
|
||||||
assert sample_blob("Scripts/jquery-1.7-vsdoc.js").vendored?
|
assert sample_blob("Scripts/jquery-1.7-vsdoc.js").vendored?
|
||||||
@@ -423,7 +415,7 @@ class TestBlob < Minitest::Test
|
|||||||
assert sample_blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
|
assert sample_blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
|
||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
assert sample_blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js", true).vendored?
|
assert sample_blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
|
||||||
|
|
||||||
# Font Awesome
|
# Font Awesome
|
||||||
assert sample_blob("some/asset/path/font-awesome.min.css").vendored?
|
assert sample_blob("some/asset/path/font-awesome.min.css").vendored?
|
||||||
@@ -433,15 +425,15 @@ class TestBlob < Minitest::Test
|
|||||||
assert sample_blob("some/asset/path/normalize.css").vendored?
|
assert sample_blob("some/asset/path/normalize.css").vendored?
|
||||||
|
|
||||||
# Cocoapods
|
# Cocoapods
|
||||||
assert sample_blob('Pods/blah', true).vendored?
|
assert sample_blob('Pods/blah').vendored?
|
||||||
|
|
||||||
# Html5shiv
|
# Html5shiv
|
||||||
assert sample_blob("Scripts/html5shiv.js").vendored?
|
assert sample_blob("Scripts/html5shiv.js").vendored?
|
||||||
assert sample_blob("Scripts/html5shiv.min.js").vendored?
|
assert sample_blob("Scripts/html5shiv.min.js").vendored?
|
||||||
|
|
||||||
# Test fixtures
|
# Test fixtures
|
||||||
assert sample_blob("test/fixtures/random.rkt", true).vendored?
|
assert sample_blob("test/fixtures/random.rkt").vendored?
|
||||||
assert sample_blob("Test/fixtures/random.rkt", true).vendored?
|
assert sample_blob("Test/fixtures/random.rkt").vendored?
|
||||||
|
|
||||||
# Cordova/PhoneGap
|
# Cordova/PhoneGap
|
||||||
assert sample_blob("cordova.js").vendored?
|
assert sample_blob("cordova.js").vendored?
|
||||||
@@ -455,7 +447,7 @@ class TestBlob < Minitest::Test
|
|||||||
assert sample_blob("foundation.abide.js").vendored?
|
assert sample_blob("foundation.abide.js").vendored?
|
||||||
|
|
||||||
# Vagrant
|
# Vagrant
|
||||||
assert sample_blob("Vagrantfile", true).vendored?
|
assert sample_blob("Vagrantfile").vendored?
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
assert sample_blob("gradlew").vendored?
|
assert sample_blob("gradlew").vendored?
|
||||||
|
|||||||
Reference in New Issue
Block a user