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
65dde580
Commit
65dde580
authored
8 years ago
by
Alyssa Ross
Browse files
Options
Downloads
Patches
Plain Diff
tests: add some emoji tests
parent
b0fea9eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/test/emoji_test.rb
+11
-0
11 additions, 0 deletions
Library/Homebrew/test/emoji_test.rb
Library/Homebrew/test/utils_test.rb
+22
-0
22 additions, 0 deletions
Library/Homebrew/test/utils_test.rb
with
33 additions
and
0 deletions
Library/Homebrew/test/emoji_test.rb
0 → 100644
+
11
−
0
View file @
65dde580
require
"testing_env"
require
"emoji"
class
EmojiTest
<
Homebrew
::
TestCase
def
test_install_badge
assert_equal
"🍺"
,
Emoji
.
install_badge
ENV
[
"HOMEBREW_INSTALL_BADGE"
]
=
"foo"
assert_equal
"foo"
,
Emoji
.
install_badge
end
end
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/utils_test.rb
+
22
−
0
View file @
65dde580
...
...
@@ -9,6 +9,14 @@ class UtilTests < Homebrew::TestCase
@dir
=
Pathname
.
new
(
mktmpdir
)
end
# Helper for matching escape sequences.
def
e
(
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?
...
...
@@ -22,11 +30,25 @@ class UtilTests < Homebrew::TestCase
end
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"
))
ENV
[
"HOMEBREW_NO_EMOJI"
]
=
"1"
assert_match
(
/\A
#{
e
1
}
foo \(installed\)
#{
Z
}
/
,
pretty_installed
(
"foo"
))
$stdout
.
stubs
(
:tty?
).
returns
false
assert_equal
"foo"
,
pretty_installed
(
"foo"
)
end
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"
))
ENV
[
"HOMEBREW_NO_EMOJI"
]
=
"1"
assert_match
(
/\A
#{
e
1
}
foo \(uninstalled\)
#{
Z
}
/
,
pretty_uninstalled
(
"foo"
))
$stdout
.
stubs
(
:tty?
).
returns
false
assert_equal
"foo"
,
pretty_uninstalled
(
"foo"
)
end
...
...
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