Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add actual arch name in set
Browse files Browse the repository at this point in the history
brian6932 committed Oct 4, 2023
1 parent df9af2f commit e123aa0
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/core.ps1
Original file line number Diff line number Diff line change
@@ -1080,9 +1080,9 @@ function Format-ArchitectureString($Architecture) {
}
$Architecture = $Architecture.ToString().ToLower()
switch ($Architecture) {
{ ([System.Collections.Generic.HashSet[String]][string[]]@('avx512', 'amd64-v4', 'amd64_v4', 'x64-v4', 'x64_v4', 'x86_64-v4', 'x86-64_v4')).Contains($_) } { return '64bit-v4' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('avx2', 'amd64-v3', 'amd64_v3', 'x64-v3', 'x64_v3', 'x86_64-v3', 'x86-64_v3')).Contains($_) } { return '64bit-v3' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('sse4.2', 'sse4_2', 'sse4-2', 'amd64-v2', 'amd64_v2', 'x64-v2', 'x64_v2', 'x86_64-v2', 'x86-64_v2')).Contains($_) } { return '64bit-v2' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('64bit-v4', '64bit_v4', 'avx512', 'amd64-v4', 'amd64_v4', 'x64-v4', 'x64_v4', 'x86_64-v4', 'x86-64_v4')).Contains($_) } { return '64bit-v4' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('64bit-v3', '64bit_v3', 'avx2', 'amd64-v3', 'amd64_v3', 'x64-v3', 'x64_v3', 'x86_64-v3', 'x86-64_v3')).Contains($_) } { return '64bit-v3' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('64bit-v2', '64bit_v2', 'sse4.2', 'sse4_2', 'sse4-2', 'amd64-v2', 'amd64_v2', 'x64-v2', 'x64_v2', 'x86_64-v2', 'x86-64_v2')).Contains($_) } { return '64bit-v2' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('64bit', '64', 'x64', 'amd64', 'x86_64', 'x86-64')).Contains($_) } { return '64bit' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('32bit', '32', 'x86', 'i386', '386', 'i686')).Contains($_) } { return '32bit' }
{ ([System.Collections.Generic.HashSet[String]][string[]]@('arm64', 'arm', 'aarch64')).Contains($_) } { return 'arm64' }
6 changes: 6 additions & 0 deletions test/Scoop-Core.Tests.ps1
Original file line number Diff line number Diff line change
@@ -401,6 +401,8 @@ Describe 'Format Architecture String' -Tag 'Scoop' {
Format-ArchitectureString '386' | Should -Be '32bit'
Format-ArchitectureString 'i686' | Should -Be '32bit'

Format-ArchitectureString '64bit-v4' | Should -Be '64bit-v4'
Format-ArchitectureString '64bit_v4' | Should -Be '64bit-v4'
Format-ArchitectureString 'avx512' | Should -Be '64bit-v4'
Format-ArchitectureString 'amd64-v4' | Should -Be '64bit-v4'
Format-ArchitectureString 'amd64_v4' | Should -Be '64bit-v4'
@@ -409,6 +411,8 @@ Describe 'Format Architecture String' -Tag 'Scoop' {
Format-ArchitectureString 'x86_64-v4' | Should -Be '64bit-v4'
Format-ArchitectureString 'x86-64_v4' | Should -Be '64bit-v4'

Format-ArchitectureString '64bit_v3' | Should -Be '64bit-v3'
Format-ArchitectureString '64bit_v3' | Should -Be '64bit-v3'
Format-ArchitectureString 'avx2' | Should -Be '64bit-v3'
Format-ArchitectureString 'amd64-v3' | Should -Be '64bit-v3'
Format-ArchitectureString 'amd64_v3' | Should -Be '64bit-v3'
@@ -417,6 +421,8 @@ Describe 'Format Architecture String' -Tag 'Scoop' {
Format-ArchitectureString 'x86_64-v3' | Should -Be '64bit-v3'
Format-ArchitectureString 'x86-64_v3' | Should -Be '64bit-v3'

Format-ArchitectureString '64bit-v2' | Should -Be '64bit-v2'
Format-ArchitectureString '64bit_v2' | Should -Be '64bit-v2'
Format-ArchitectureString 'sse4.2' | Should -Be '64bit-v2'
Format-ArchitectureString 'sse4_2' | Should -Be '64bit-v2'
Format-ArchitectureString 'sse4-2' | Should -Be '64bit-v2'

0 comments on commit e123aa0

Please sign in to comment.