aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2016-01-14 20:33:10 +0800
committerXu Cheng2016-01-15 16:26:04 +0800
commit8deec537d15d35821be4e8e253ad2a877535cbc8 (patch)
tree110ec775d2a1489b0062acaa6e008480075f4724 /Library
parent7958343f1694a72c8f15b7bf0e00a888fa321996 (diff)
downloadbrew-8deec537d15d35821be4e8e253ad2a877535cbc8.tar.bz2
test_download_strategies: add mtime test
Diffstat (limited to 'Library')
l---------Library/Homebrew/test/resources/source-with-broken-symlink/broken-link1
-rw-r--r--Library/Homebrew/test/test_bottle.rb8
-rw-r--r--Library/Homebrew/test/test_download_strategies.rb11
3 files changed, 11 insertions, 9 deletions
diff --git a/Library/Homebrew/test/resources/source-with-broken-symlink/broken-link b/Library/Homebrew/test/resources/source-with-broken-symlink/broken-link
deleted file mode 120000
index cfa0a4651..000000000
--- a/Library/Homebrew/test/resources/source-with-broken-symlink/broken-link
+++ /dev/null
@@ -1 +0,0 @@
-does-not-exist \ No newline at end of file
diff --git a/Library/Homebrew/test/test_bottle.rb b/Library/Homebrew/test/test_bottle.rb
deleted file mode 100644
index f4398cc1d..000000000
--- a/Library/Homebrew/test/test_bottle.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require "testing_env"
-require "cmd/bottle"
-
-class BottleTests < Homebrew::TestCase
- def test_most_recent_mtime_with_broken_symlink()
- refute_nil Homebrew.most_recent_mtime(Pathname(File.join(TEST_DIRECTORY, 'resources/source-with-broken-symlink')))
- end
-end
diff --git a/Library/Homebrew/test/test_download_strategies.rb b/Library/Homebrew/test/test_download_strategies.rb
index 45d0d3188..24f38ad2d 100644
--- a/Library/Homebrew/test/test_download_strategies.rb
+++ b/Library/Homebrew/test/test_download_strategies.rb
@@ -11,6 +11,8 @@ class ResourceDouble
end
class AbstractDownloadStrategyTests < Homebrew::TestCase
+ include FileUtils
+
def setup
@name = "foo"
@resource = ResourceDouble.new
@@ -34,6 +36,15 @@ class AbstractDownloadStrategyTests < Homebrew::TestCase
assert_equal %w[foo bar baz], @args
refute_same @args, result
end
+
+ def test_source_modified_time
+ mktemp "mtime" do
+ touch "foo", :mtime => Time.now - 10
+ touch "bar", :mtime => Time.now - 100
+ ln_s "not-exist", "baz"
+ assert_equal File.mtime("foo"), @strategy.source_modified_time
+ end
+ end
end
class VCSDownloadStrategyTests < Homebrew::TestCase