techthoughts2 / Catesta

Catesta is a PowerShell module and vault project generator. It uses templates to rapidly scaffold test and build integration for a variety of CI/CD platforms.
https://www.catesta.dev/
MIT License
169 stars 20 forks source link

Fix function help example test #33

Closed TsekNet closed 4 years ago

TsekNet commented 4 years ago

Pull Request

Issue

Function help example tests fail initially, as $help.examples.example does not have the count member property.

Issue #, if available:

Description

Description of changes:

Leverage the same tests used when testing function synopsis and description to ensure that the function help example exists, which is effectively the same as saying there's at least one example.

Tests run:

$help = get-help Set-CustomPrompt -full

PS> $help.examples.example

-------------------------- EXAMPLE 1 --------------------------

PS C:\>Set-CustomPrompt -Symbol '26A1' -Force

Forces the prompt to change, using the 'High Voltage' Emoji (⚡) as the
ASCII character is placed before the cursor.

PS> $help.examples.example.count

PS> $help.examples.example | Get-Member 

   TypeName: MamlCommandHelpInfo#example

Name         MemberType   Definition
----         ----------   ----------
Equals       Method       bool Equals(System.Object obj)
GetHashCode  Method       int GetHashCode()
GetType      Method       type GetType()
ToString     Method       string ToString()
code         NoteProperty System.String code=Set-CustomPrompt -Symbol '26A1' -Force
introduction NoteProperty psobject[] introduction=System.Management.Automation.PSObject[]
remarks      NoteProperty psobject[] remarks=System.Management.Automation.PSObject[]
title        NoteProperty System.String title=-------------------------- EXAMPLE 1 --------------------------

License

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.