diff options
| author | Zhiming Wang | 2016-12-25 18:54:08 -0500 |
|---|---|---|
| committer | Mike McQuaid | 2017-03-20 18:20:31 +0200 |
| commit | 1c10a6260fb4f4036d68b4c34acc6135b26b93d6 (patch) | |
| tree | 2924c8b8295cbe1a60a6d5980f3a656c67387cc1 /Library/Homebrew/test | |
| parent | 00af5250f0a7988178ed8d26520bf1a98a8dea9a (diff) | |
| download | brew-1c10a6260fb4f4036d68b4c34acc6135b26b93d6.tar.bz2 | |
Hint at new location of migrated formulae
Partial implementation of
https://github.com/Homebrew/brew-evolution/pull/15, along with the ability to
search for deleted formulae in git history (inspired by #1996) which is not
described in the proposal.
See also: #1371.
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/historic_test.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Library/Homebrew/test/historic_test.rb b/Library/Homebrew/test/historic_test.rb new file mode 100644 index 000000000..d09656fe0 --- /dev/null +++ b/Library/Homebrew/test/historic_test.rb @@ -0,0 +1,46 @@ +require "testing_env" +require "historic" + +class HistoricTest < Homebrew::TestCase + def setup + super + + @path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo" + @path.mkpath + @tap = Tap.new("Homebrew", "foo") + + (@path/"tap_migrations.json").write <<-EOS.undent + { "migrated-formula": "homebrew/bar" } + EOS + (@path/"Formula/to-delete.rb").write "placeholder" + + @path.cd do + shutup do + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", "initial state" + system "git", "rm", "Formula/to-delete.rb" + system "git", "commit", "-m", "delete formula 'to-delete'" + end + end + end + + def teardown + @path.rmtree + + super + end + + def test_search_for_migrated_formula + migrations = Homebrew.search_for_migrated_formula("migrated-formula", print_messages: false) + assert_equal [[@tap, "homebrew/bar"]], migrations + end + + def test_search_for_deleted_formula + tap, relpath, hash, = Homebrew.search_for_deleted_formula("homebrew/foo/to-delete", + print_messages: false) + assert_equal tap, @tap + assert_equal relpath, "Formula/to-delete.rb" + assert_equal `git rev-parse HEAD`.chomp, hash + end +end |
