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
5480a841
Commit
5480a841
authored
8 years ago
by
Alyssa Ross
Browse files
Options
Downloads
Patches
Plain Diff
tests: give `e` helper in UtilTests a better name
parent
65dde580
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/utils_test.rb
+9
-9
9 additions, 9 deletions
Library/Homebrew/test/utils_test.rb
with
9 additions
and
9 deletions
Library/Homebrew/test/utils_test.rb
+
9
−
9
View file @
5480a841
...
...
@@ -9,14 +9,10 @@ class UtilTests < Homebrew::TestCase
@dir
=
Pathname
.
new
(
mktmpdir
)
end
# Helper for matching escape sequences.
def
e
(
code
)
def
esc
(
code
)
/(\e\[\d+m)*\e\[
#{
code
}
m/
end
# Helper for matching that style is reset at the end of a string.
Z
=
/(\e\[\d+m)*\e\[0m\Z/
def
test_ofail
shutup
{
ofail
"foo"
}
assert
Homebrew
.
failed?
...
...
@@ -32,10 +28,12 @@ class UtilTests < Homebrew::TestCase
def
test_pretty_installed
$stdout
.
stubs
(
:tty?
).
returns
true
ENV
.
delete
(
"HOMEBREW_NO_EMOJI"
)
assert_match
(
/\A
#{
e
1
}
foo
#{
e
32
}
✔
#{
Z
}
/
,
pretty_installed
(
"foo"
))
tty_with_emoji_output
=
/\A
#{
esc
1
}
foo
#{
esc
32
}
✔
#{
esc
0
}
\Z/
assert_match
tty_with_emoji_output
,
pretty_installed
(
"foo"
)
ENV
[
"HOMEBREW_NO_EMOJI"
]
=
"1"
assert_match
(
/\A
#{
e
1
}
foo \(installed\)
#{
Z
}
/
,
pretty_installed
(
"foo"
))
tty_no_emoji_output
=
/\A
#{
esc
1
}
foo \(installed\)
#{
esc
0
}
\Z/
assert_match
tty_no_emoji_output
,
pretty_installed
(
"foo"
)
$stdout
.
stubs
(
:tty?
).
returns
false
assert_equal
"foo"
,
pretty_installed
(
"foo"
)
...
...
@@ -44,10 +42,12 @@ class UtilTests < Homebrew::TestCase
def
test_pretty_uninstalled
$stdout
.
stubs
(
:tty?
).
returns
true
ENV
.
delete
(
"HOMEBREW_NO_EMOJI"
)
assert_match
(
/\A
#{
e
1
}
foo
#{
e
31
}
✘
#{
Z
}
/
,
pretty_uninstalled
(
"foo"
))
tty_with_emoji_output
=
/\A
#{
esc
1
}
foo
#{
esc
31
}
✘
#{
esc
0
}
\Z/
assert_match
tty_with_emoji_output
,
pretty_uninstalled
(
"foo"
)
ENV
[
"HOMEBREW_NO_EMOJI"
]
=
"1"
assert_match
(
/\A
#{
e
1
}
foo \(uninstalled\)
#{
Z
}
/
,
pretty_uninstalled
(
"foo"
))
tty_no_emoji_output
=
/\A
#{
esc
1
}
foo \(uninstalled\)
#{
esc
0
}
\Z/
assert_match
tty_no_emoji_output
,
pretty_uninstalled
(
"foo"
)
$stdout
.
stubs
(
:tty?
).
returns
false
assert_equal
"foo"
,
pretty_uninstalled
(
"foo"
)
...
...
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