Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
454003c4
Unverified
Commit
454003c4
authored
8 years ago
by
Vlad Shablinsky
Committed by
Xu Cheng
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test_formula: test new HEAD methods
* Test `Formula#update_head_version` * Test `Formula#latest_head_prefix`
parent
458f9a00
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/test/test_formula.rb
+55
-0
55 additions, 0 deletions
Library/Homebrew/test/test_formula.rb
with
55 additions
and
0 deletions
Library/Homebrew/test/test_formula.rb
+
55
−
0
View file @
454003c4
...
...
@@ -158,6 +158,29 @@ class FormulaTests < Homebrew::TestCase
assert_equal
prefix
,
f
.
installed_prefix
end
def
test_latest_head_prefix
f
=
Testball
.
new
stamps_with_revisions
=
[[
111111
,
1
],
[
222222
,
1
],
[
222222
,
2
],
[
222222
,
0
]]
stamps_with_revisions
.
each
do
|
stamp
,
revision
|
version
=
"HEAD-
#{
stamp
}
"
version
+=
"_
#{
revision
}
"
if
revision
>
0
prefix
=
f
.
rack
.
join
(
version
)
prefix
.
mkpath
tab
=
Tab
.
empty
tab
.
tabfile
=
prefix
.
join
(
"INSTALL_RECEIPT.json"
)
tab
.
source_modified_time
=
stamp
tab
.
write
end
prefix
=
HOMEBREW_CELLAR
/
"
#{
f
.
name
}
/HEAD-222222_2"
assert_equal
prefix
,
f
.
latest_head_prefix
ensure
f
.
rack
.
rmtree
end
def
test_equality
x
=
Testball
.
new
y
=
Testball
.
new
...
...
@@ -282,6 +305,38 @@ class FormulaTests < Homebrew::TestCase
assert_equal
PkgVersion
.
parse
(
"HEAD_1"
),
f
.
pkg_version
end
def
test_update_head_version
initial_env
=
ENV
.
to_hash
f
=
formula
do
head
"foo"
,
:using
=>
:git
end
cached_location
=
f
.
head
.
downloader
.
cached_location
cached_location
.
mkpath
%w[AUTHOR COMMITTER]
.
each
do
|
role
|
ENV
[
"GIT_
#{
role
}
_NAME"
]
=
"brew tests"
ENV
[
"GIT_
#{
role
}
_EMAIL"
]
=
"brew-tests@localhost"
ENV
[
"GIT_
#{
role
}
_DATE"
]
=
"Thu May 21 00:04:11 2009 +0100"
end
cached_location
.
cd
do
FileUtils
.
touch
"LICENSE"
shutup
do
system
"git"
,
"init"
system
"git"
,
"add"
,
"--all"
system
"git"
,
"commit"
,
"-m"
,
"Initial commit"
end
end
f
.
update_head_version
assert_equal
Version
.
create
(
"HEAD-5658946"
),
f
.
head
.
version
ensure
ENV
.
replace
(
initial_env
)
cached_location
.
rmtree
end
def
test_legacy_options
f
=
formula
do
url
"foo-1.0"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment