Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PSKoans/Koans/Cmdlets 1/AboutPSProviders.Koans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Describe 'Environment Provider' {

Describe 'FileSystem Provider' {
BeforeAll {
$Path = 'TestDrive:' | Join-Path -ChildPath 'File001.tmp'
$Path = 'TEMP:' | Join-Path -ChildPath 'File001.tmp'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEMP: as a pre-existing PSDrive doesn't exist until PS6 or 7 I think?

TestDrive: is provided by Pester and cleans up after itself without us having to do any manual work to do so. Was this one not working for you? 🙂


$FileContent = @'
PSKOANS!
Expand Down
1 change: 1 addition & 0 deletions PSKoans/Koans/Foundations/AboutArrays.Koans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Describe 'Arrays' {
}

It 'can reverse an array' {
$Array = 1, 2, 3, 4, 5, 6, 7
$LastIndex = __
$Array[-1..$LastIndex] | Should -Be @(7, 6, 5, 4, 3, 2, 1)
}
Expand Down
2 changes: 1 addition & 1 deletion PSKoans/Koans/Foundations/AboutHashtables.Koans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Describe 'Hashtables' {
$Hashtable.ContainsValue('Fruit') | Should -BeTrue

$Hashtable['Oranges'] | Should -Be 'Fruit'
$Hashtable['Carrots'] | Should -Not -Be $Hashtable['Oranges']
$Hashtable['Carrots'] | Should -Be $Hashtable['Oranges']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might need more clarification, for sure, but I don't think this is the problem here.

The conditions as set without changing this line are that the hashtable must:

  1. contain at least one key name that is Carrots
  2. have at least one of the values be 'Fruit'
  3. the key Oranges should map to the value 'Fruit'
  4. the value for Carrots should not be the same as the value for Oranges

The intended solution is for carrots to be marked as 'Vegetables' when adding keys to the hashtable. 🙂

Is there a way we can make that a bit more clear for this koan?

}

It 'will not implicitly convert keys and lookup values' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Describe 'Pipelines and Loops' {
#>
$i
}
$Values | Should -Be @(0, 1, 2, 3, 4)
$Values | Should -Be __
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I tend to prefer that blanks take a similar form to what's expected; we're expecting an array here, so a single blank is a bit misleading imo.

Perhaps something like this would be better?

$ExpectedValues = @(
    __
    __
    __
    __
    __
)

$ExpectedValues | Should -Be $Values

}

It 'can loop while a condition is $true' {
Expand Down
10 changes: 9 additions & 1 deletion PSKoans/Koans/Katas/ProcessingStrings.Koans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ param()
[double] $value # Casts (converts) the value into numerical data
$String -split ',' # Creates an array by splitting the string

Be sure to review AboutStrings and AboutArrays if you need to!
Be sure to review AboutStrings, AboutArrays and the other foundation Koans
you've done so far if you get stuck!

Testimonial:
"Can someone give me a hint on how to do this, I feel stupid."
-Puzzled PowerShell Newbie

"I might have to steal this for a 'testimonials' section; that's exactly what the katas are meant for :D."
-Joel
#>
Describe "The Stock Challenge" {
BeforeAll {
Expand Down
8 changes: 4 additions & 4 deletions PSKoans/Koans/Katas/SortingCharacters.Koans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,23 @@ Describe 'Kata - Sorting Characters' {
}
@{
String = 'What do you call the world?'
Result = 'aacddehhlllooorttuwWy'
Result = 'aacddehhlllooorttuWwy'
}
@{
String = 'Out of nowhere, the mind comes forth.'
Result = 'cdeeeeffhhhimmnnooOoorrstttuw'
Result = 'cdeeeeffhhhimmnnOoooorrstttuw'
}
@{
String = 'Because it is so very clear, it takes longer to come to the realization.'
Result = 'aaaaaBccceeeeeeeeeghiiiiiklllmnnoooooorrrrsssstttttttuvyz'
}
@{
String = 'The hands of the world are open.'
Result = 'aaddeeeefhhhlnnoooprrstTw'
Result = 'aaddeeeefhhhlnnoooprrsTtw'
}
@{
String = 'You are those huge waves sweeping everything before them, swallowing all in their path.'
Result = 'aaaaabeeeeeeeeeeeefgggghhhhhhiiiiillllmnnnnoooopprrrrsssstttttuuvvwwwwyY'
Result = 'aaaaabeeeeeeeeeeeefgggghhhhhhiiiiillllmnnnnoooopprrrrsssstttttuuvvwwwwYy'
Comment on lines +70 to +86
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share the code you used to get these results?

I remember what I did to get the result I laid out in there, but there's a good chance it didn't play nice with the upper and lower cases. This looks right, just want to verify :)

}
)
}