Skip to content
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

Revisit AboutArrays section #330

Closed
vexx32 opened this issue Nov 26, 2019 · 0 comments · Fixed by #347
Closed

Revisit AboutArrays section #330

vexx32 opened this issue Nov 26, 2019 · 0 comments · Fixed by #347
Assignees
Labels
Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it!

Comments

@vexx32
Copy link
Owner

vexx32 commented Nov 26, 2019

Describe "Koan Bug, Issue, or Help Request"

This section of AboutArrays needs to be revisited. The format of the assertions is a bit more confusing than it needs to be. Consider moving / removing some of the blanks, and perhaps splitting out this singular It into a few separate It blocks.

Context "The Problematic Assertions"

It 'is usually of type Object[]' {
<#
Arrays in PowerShell are created with the type Object[]. An array of Objects.
The Object type can hold anything at all. A numeric value, a character, a Process, and so on.
#>
$Numbers = 1, 2, 3, 4
'____' | Should -Be $Numbers.GetType().Name
$Strings = 'first', 'second', 'third'
[____] | Should -Be $Strings.GetType()
$Processes = Get-Process
'____' | Should -Be $Processes.GetType().Name
<#
The base type of Object[], Char[], and other fixed size array types is the System.Array
type, or [Array].
The [Array] type describes the Length property (aliased to Count), as well as other methods
which can be used to work with the array.
The available methods can be seen with Get-Member:
Get-Member -InputObject @()
For example, each array has a Contains method.
#>
$____ -eq $Numbers.Contains(3) | Should -BeTrue
# The Contains method is case sensitive for arrays containing strings.
$____ -eq $Strings.Contains('first') | Should -BeTrue
$____ -eq $Strings.Contains('First') | Should -BeTrue
# PowerShell's -contains operator is not case sensitive.
$Strings -contains '____' | Should -BeTrue
$Strings -contains '____' | Should -BeTrue
}

Context "Your Attempts"

Possibly we should look at using blanks in a more straightforward way, e.g.,

$Item = __
$Numbers.Contains($Item) | Should -BeTrue
# And also introduce this Pester syntax as well as just the .Contains() method
$Numbers | Should -Contain $Item
@vexx32 vexx32 added Up For Grabs / Hacktoberfest 💻 If it's Up For Grabs, take it and run with it! If not, ask if it's in progress / you can take it. Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it! Hacktoberfest labels Nov 26, 2019
@vexx32 vexx32 removed Hacktoberfest 💻 Up For Grabs / Hacktoberfest 💻 If it's Up For Grabs, take it and run with it! If not, ask if it's in progress / you can take it. labels Jan 15, 2020
@vexx32 vexx32 self-assigned this Jan 18, 2020
vexx32 added a commit that referenced this issue Jan 18, 2020
vexx32 added a commit that referenced this issue Jan 19, 2020
* 🔧 Resolve issues in AboutModules

Fixes #342

* 🔧 Fix issues in AboutTeeObject

Fixes #341

Also added a new koan to show when the variable is created

* 🔧 Fix issues in AboutMeasureObject

Fixes #340

* 🔧 Fix issues in AboutSelectObject

Fixes #339

Fixes #337

* 🔧 Fix issue in AboutAssignmentAndArithmetic

Fixes #334

* 🔧 Fix issues in AboutDiscovery

Fixes #335

Fixes #332

* 🔧 ♻️ Fix up AboutArrays

Fixes #330

* 🔧 Fix missing variable reference

* 🎨 Update format of array declaration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant