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
15 changes: 14 additions & 1 deletion src/Convert/Convert.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Convert.psm1'

# Version number of this module.
ModuleVersion = '2.0.7'
ModuleVersion = '2.0.8'

# Supported PSEditions
CompatiblePSEditions = @(
Expand Down Expand Up @@ -117,6 +117,19 @@
'ConvertFrom-Base64StringToByteArray'
'ConvertFrom-ByteArrayToBase64String'
'ConvertFrom-StreamToString'
'cfb64'
'cfurl'
'cfut'
'ctb64'
'ctc'
'ctf'
'cthash'
'cthmac'
'ctstr'
'cttc'
'cturl'
'ctut'
'gut'
)

# DSC resources to export from this module
Expand Down
2 changes: 1 addition & 1 deletion src/Convert/Public/ConvertFrom-Base64ToString.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
function ConvertFrom-Base64ToString {
[CmdletBinding(HelpUri = 'https://austoonz.github.io/Convert/functions/ConvertFrom-Base64ToString/')]
[OutputType('String')]
[Alias('ConvertFrom-Base64StringToString')]
[Alias('ConvertFrom-Base64StringToString', 'cfb64')]
param
(
[Parameter(
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertFrom-EscapedUrl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#>
function ConvertFrom-EscapedUrl {
[CmdletBinding()]
[Alias('cfurl')]
param (
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[ValidateNotNullOrEmpty()]
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertFrom-UnixTime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#>
function ConvertFrom-UnixTime {
[CmdletBinding()]
[Alias('cfut')]
param (
# The Unix time to convert. Represented in seconds by default, or in milliseconds if the FromMilliseconds
# parameter is specified.
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-Base64.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function ConvertTo-Base64 {
[CmdletBinding(
DefaultParameterSetName = 'String',
HelpUri = 'https://austoonz.github.io/Convert/functions/ConvertTo-Base64/')]
[Alias('ctb64')]
param
(
[Parameter(
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-Celsius.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function ConvertTo-Celsius {
[CmdletBinding()]
[OutputType([double])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]
[Alias('ctc')]
param (
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-EscapedUrl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#>
function ConvertTo-EscapedUrl {
[CmdletBinding()]
[Alias('cturl')]
param (
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[ValidateNotNullOrEmpty()]
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-Fahrenheit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
function ConvertTo-Fahrenheit {
[CmdletBinding()]
[OutputType([double])]
[Alias('ctf')]
param (
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-Hash.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#>
function ConvertTo-Hash {
[CmdletBinding()]
[Alias('cthash')]
param (
[Parameter(ParameterSetName = 'String', ValueFromPipeline, ValueFromPipelineByPropertyName)]
[string[]]$String,
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-HmacHash.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
function ConvertTo-HmacHash {
[CmdletBinding(DefaultParameterSetName = 'ProvidedKey')]
[OutputType([String], [Byte[]], [PSCustomObject])]
[Alias('cthmac')]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[AllowNull()]
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-String.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function ConvertTo-String {
[CmdletBinding(
DefaultParameterSetName = 'Base64String',
HelpUri = 'https://austoonz.github.io/Convert/functions/ConvertTo-String/')]
[Alias('ctstr')]
param
(
[Parameter(
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-TitleCase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#>
function ConvertTo-TitleCase {
[CmdletBinding()]
[Alias('cttc')]
param (
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[ValidateNotNullOrEmpty()]
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/ConvertTo-UnixTime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#>
function ConvertTo-UnixTime {
[CmdletBinding()]
[Alias('ctut')]
param (
# A DateTime object representing the time to convert. Defaults to `[datetime]::UtcNow`.
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
Expand Down
1 change: 1 addition & 0 deletions src/Convert/Public/Get-UnixTime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#>
function Get-UnixTime {
[CmdletBinding()]
[Alias('gut')]
param (
# If specified, returns the time in milliseconds that have elapsed since 00:00:00 UTC on 1 January, 1970.
[switch]$AsMilliseconds
Expand Down
8 changes: 7 additions & 1 deletion src/Tests/Unit/ConvertFrom-Base64ToString.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,14 @@ Describe -Name $function -Fixture {
It -Name 'Returns correct type' -Test {
$base64 = 'VGhpc0lzTXlTdHJpbmc='
$result = ConvertFrom-Base64ToString -String $base64 -Encoding 'UTF8'

$result | Should -BeOfType [string]
}
}

Context -Name 'Alias' -Fixture {
It -Name 'cfb64 resolves to ConvertFrom-Base64ToString' -Test {
(Get-Alias -Name 'cfb64').ResolvedCommand | Should -BeExactly 'ConvertFrom-Base64ToString'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertFrom-EscapedUrl.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,10 @@ Describe $function {
$err | Should -Not -BeNullOrEmpty
}
}

Context -Name 'Alias' -Fixture {
It -Name 'cfurl resolves to ConvertFrom-EscapedUrl' -Test {
(Get-Alias -Name 'cfurl').ResolvedCommand | Should -BeExactly 'ConvertFrom-EscapedUrl'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertFrom-UnixTime.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,10 @@ Describe -Name $function -Fixture {
$result | Should -BeOfType [datetime]
}
}

Context -Name 'Alias' -Fixture {
It -Name 'cfut resolves to ConvertFrom-UnixTime' -Test {
(Get-Alias -Name 'cfut').ResolvedCommand | Should -BeExactly 'ConvertFrom-UnixTime'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertTo-Base64.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,10 @@ Describe -Name $function -Fixture {
$result | Should -Not -BeNullOrEmpty
}
}

Context -Name 'Alias' -Fixture {
It -Name 'ctb64 resolves to ConvertTo-Base64' -Test {
(Get-Alias -Name 'ctb64').ResolvedCommand | Should -BeExactly 'ConvertTo-Base64'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertTo-Celsius.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,10 @@ Describe $function {
$result | Should -BeOfType [double]
}
}

Context 'Alias' {
It 'ctc resolves to ConvertTo-Celsius' {
(Get-Alias -Name 'ctc').ResolvedCommand | Should -BeExactly 'ConvertTo-Celsius'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertTo-EscapedUrl.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,10 @@ Describe $function {
$result | Should -Match '%'
}
}

Context -Name 'Alias' -Fixture {
It -Name 'cturl resolves to ConvertTo-EscapedUrl' -Test {
(Get-Alias -Name 'cturl').ResolvedCommand | Should -BeExactly 'ConvertTo-EscapedUrl'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertTo-Fahrenheit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,10 @@ Describe $function {
$result | Should -BeOfType [double]
}
}

Context 'Alias' {
It 'ctf resolves to ConvertTo-Fahrenheit' {
(Get-Alias -Name 'ctf').ResolvedCommand | Should -BeExactly 'ConvertTo-Fahrenheit'
}
}
}
10 changes: 8 additions & 2 deletions src/Tests/Unit/ConvertTo-Hash.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Describe -Name $function -Fixture {
}

Context -Name 'Algorithm Support' -Fixture {
It -Name 'Computes <Algorithm> hash correctly' -TestCases @(
It -Name 'Computes <Algorithm> hash correctly' -ForEach @(
@{
Algorithm = 'MD5'
Expected = '441BE86C39533902C582CB7C8BEB7CF4'
Expand Down Expand Up @@ -164,7 +164,7 @@ Describe -Name $function -Fixture {
$result2 | Should -BeExactly $result3
}

It -Name 'Produces valid hex output format for <Algorithm>' -TestCases @(
It -Name 'Produces valid hex output format for <Algorithm>' -ForEach @(
@{Algorithm = 'MD5'; Length = 32}
@{Algorithm = 'SHA1'; Length = 40}
@{Algorithm = 'SHA256'; Length = 64}
Expand Down Expand Up @@ -195,4 +195,10 @@ Describe -Name $function -Fixture {
$utf8Result | Should -BeExactly $asciiResult
}
}

Context -Name 'Alias' -Fixture {
It -Name 'cthash resolves to ConvertTo-Hash' -Test {
(Get-Alias -Name 'cthash').ResolvedCommand | Should -BeExactly 'ConvertTo-Hash'
}
}
}
12 changes: 9 additions & 3 deletions src/Tests/Unit/ConvertTo-HmacHash.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Describe -Name $function -Fixture {
}

Context -Name 'Algorithm Validation' -Fixture {
It -Name "Produces correct HMAC with <Algorithm>" -TestCases @(
It -Name "Produces correct HMAC with <Algorithm>" -ForEach @(
@{ Algorithm = 'HMACSHA256' }
@{ Algorithm = 'HMACSHA384' }
@{ Algorithm = 'HMACSHA512' }
Expand Down Expand Up @@ -112,7 +112,7 @@ Describe -Name $function -Fixture {
}

Context -Name 'Encoding Options' -Fixture {
It -Name "Handles different text encodings" -TestCases @(
It -Name "Handles different text encodings" -ForEach @(
@{ Encoding = 'UTF8'; Data = "Test String with special chars: äöü" }
@{ Encoding = 'ASCII'; Data = "Test String with ASCII only chars" }
@{ Encoding = 'Unicode'; Data = "Test String with special chars: äöü" }
Expand Down Expand Up @@ -396,7 +396,7 @@ Describe -Name $function -Fixture {
$stream.Dispose()
}

It -Name "Supports all output formats with Rust" -TestCases @(
It -Name "Supports all output formats with Rust" -ForEach @(
@{ Format = 'Hex'; ExpectedLength = 64; ExpectedType = 'String' }
@{ Format = 'Base64'; ExpectedType = 'String' }
@{ Format = 'ByteArray'; ExpectedLength = 32; ExpectedType = 'Byte' }
Expand Down Expand Up @@ -463,4 +463,10 @@ Describe -Name $function -Fixture {
$result | Should -BeNullOrEmpty
}
}

Context -Name 'Alias' -Fixture {
It -Name 'cthmac resolves to ConvertTo-HmacHash' -Test {
(Get-Alias -Name 'cthmac').ResolvedCommand | Should -BeExactly 'ConvertTo-HmacHash'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertTo-String.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,10 @@ Describe -Name $function -Fixture {
$writer2.Dispose()
}
}

Context -Name 'Alias' -Fixture {
It -Name 'ctstr resolves to ConvertTo-String' -Test {
(Get-Alias -Name 'ctstr').ResolvedCommand | Should -BeExactly 'ConvertTo-String'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertTo-TitleCase.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ Describe $function {
$assertion = $strings | ConvertTo-TitleCase
$assertion | Should -BeExactly $expected
}

Context 'Alias' {
It 'cttc resolves to ConvertTo-TitleCase' {
(Get-Alias -Name 'cttc').ResolvedCommand | Should -BeExactly 'ConvertTo-TitleCase'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/ConvertTo-UnixTime.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,10 @@ Describe -Name $function -Fixture {
$result | Should -BeOfType [long]
}
}

Context -Name 'Alias' -Fixture {
It -Name 'ctut resolves to ConvertTo-UnixTime' -Test {
(Get-Alias -Name 'ctut').ResolvedCommand | Should -BeExactly 'ConvertTo-UnixTime'
}
}
}
6 changes: 6 additions & 0 deletions src/Tests/Unit/Get-UnixTime.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ Describe -Name $function -Fixture {
(($epochTime + [System.TimeSpan]::FromMilliseconds($assertion)) - $now).TotalMilliseconds | Should -BeLessThan 1000
}
}

Context -Name 'Alias' -Fixture {
It -Name 'gut resolves to Get-UnixTime' -Test {
(Get-Alias -Name 'gut').ResolvedCommand | Should -BeExactly 'Get-UnixTime'
}
}
}
Loading
Loading