Skip to content

Commit

Permalink
Update the test suite
Browse files Browse the repository at this point in the history
Previous test were passed even when the capitalization doesnt match
  • Loading branch information
glaxxie committed Jan 25, 2024
1 parent dab3fbb commit cceae3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion exercises/practice/acronym/.meta/Acronym.example.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Function Get-Acronym() {
Param (
[string]$Phrase
)
return ([regex]::Matches($Phrase, "\p{L}+'?\p{L}*") | ForEach-Object { $_.Value[0] }) -join ""
(-join ([regex]::Matches($Phrase, "\p{L}+'?\p{L}*") | ForEach-Object { ($_.Value[0]) })).ToUpper()
}
18 changes: 9 additions & 9 deletions exercises/practice/acronym/Acronym.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,54 @@ Describe "AcronymTests" {
It "basic" {
$got = Get-Acronym -Phrase "Portable Networks Graphic"
$want = "PNG"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "lowercase words" {
$got = Get-Acronym -Phrase "Ruby on Rails"
$want = "ROR"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "punctuation" {
$got = Get-Acronym -Phrase "First in, First out"
$want = "FIFO"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "all caps word" {
$got = Get-Acronym -Phrase "GNU Image Manipulation Program"
$want = "GIMP"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "punctuation without whitespace" {
$got = Get-Acronym -Phrase "Complementary Metal-Oxide semiconductor"
$want = "CMOS"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "very long abbreviation" {
$got = Get-Acronym -Phrase "Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me"
$want = "ROTFLSHTMDCOALM"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "consecutive delimiters" {
$got = Get-Acronym -Phrase "Something - I made up from thin air"
$want = "SIMUFTA"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "apostrophes" {
$got = Get-Acronym -Phrase "Halley's Comet"
$want = "HC"
$got | Should -Be $want
$got | Should -BeExactly $want
}

It "underscore emphasis" {
$got = Get-Acronym -Phrase "The Road _Not_ Taken"
$want = "TRNT"
$got | Should -Be $want
$got | Should -BeExactly $want
}
}

0 comments on commit cceae3f

Please sign in to comment.