-
Notifications
You must be signed in to change notification settings - Fork 0
Pr-9 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Pr-9 #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module Acronym | ||
| def self.abbreviate(value) | ||
| value.scan(/\b\w/).map(&:upcase).join | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| require 'minitest/autorun' | ||
| require_relative 'acronym' | ||
|
|
||
| # Common test data version: 1.7.0 cacf1f1 | ||
| class AcronymTest < Minitest::Test | ||
| def test_basic | ||
| # skip | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove this commented out code. |
||
| assert_equal "PNG", Acronym.abbreviate('Portable Network Graphics') | ||
| end | ||
|
|
||
| def test_lowercase_words | ||
| skip | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget to remove skip to make sure the tests are passing. |
||
| assert_equal "ROR", Acronym.abbreviate('Ruby on Rails') | ||
| end | ||
|
|
||
| def test_punctuation | ||
| skip | ||
| assert_equal "FIFO", Acronym.abbreviate('First In, First Out') | ||
| end | ||
|
|
||
| def test_all_caps_word | ||
| skip | ||
| assert_equal "GIMP", Acronym.abbreviate('GNU Image Manipulation Program') | ||
| end | ||
|
|
||
| def test_punctuation_without_whitespace | ||
| skip | ||
| assert_equal "CMOS", Acronym.abbreviate('Complementary metal-oxide semiconductor') | ||
| end | ||
|
|
||
| def test_very_long_abbreviation | ||
| skip | ||
| assert_equal "ROTFLSHTMDCOALM", Acronym.abbreviate('Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me') | ||
| end | ||
|
|
||
| def test_consecutive_delimiters | ||
| skip | ||
| assert_equal "SIMUFTA", Acronym.abbreviate('Something - I made up from thin air') | ||
| end | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do we want to happen if the value is nil? |
||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a descriptive variable and an explicit
returnhere?