From cceae3f9af87ab9ce9436a59409544f26f6a6b4c Mon Sep 17 00:00:00 2001 From: glaxxie <86179463+glaxxie@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:36:21 -0600 Subject: [PATCH] Update the test suite Previous test were passed even when the capitalization doesnt match --- .../practice/acronym/.meta/Acronym.example.ps1 | 2 +- exercises/practice/acronym/Acronym.tests.ps1 | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/exercises/practice/acronym/.meta/Acronym.example.ps1 b/exercises/practice/acronym/.meta/Acronym.example.ps1 index 39a41e21..0cf2f5ee 100644 --- a/exercises/practice/acronym/.meta/Acronym.example.ps1 +++ b/exercises/practice/acronym/.meta/Acronym.example.ps1 @@ -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() } \ No newline at end of file diff --git a/exercises/practice/acronym/Acronym.tests.ps1 b/exercises/practice/acronym/Acronym.tests.ps1 index 9e785a7b..a8a61bdb 100644 --- a/exercises/practice/acronym/Acronym.tests.ps1 +++ b/exercises/practice/acronym/Acronym.tests.ps1 @@ -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 } } \ No newline at end of file