mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-05-04 16:50:37 +00:00
ebd8c036fa
* fix (decompress): `Expand-7zipArchive` only delete temp dir / `$extractDir` if it is empty (#6092) Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * refactor(download): Move download-related functions to 'download.ps1' (#6095) * fix(download): Fallback to default downloader when aria2 fails (#4292) * fix(commands): Handling broken aliases (#6141) * fix(shim): properly check `wslpath`/`cygpath` command first (#6114) Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * fix(scoop-bucket): Add missing import for `no_junction` envs (#6181) Signed-off-by: Chawye Hsu <su+git@chawyehsu.com> * docs(chglog): Update to 0.5.3 (#6258) * perf(shim): Update kiennq-shim to v3.1.2 (#6261) * fix(decompress): Replace deprecated 7ZIPEXTRACT_USE_EXTERNAL config (#6327) Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * fix(scoop-uninstall): Fix uninstaller does not gain Global state (#6430) * global arg * changelog * refactor(Get-Manifest): Select actual source for manifest (#6142) * first step * Revert "first step" This reverts commitc5907c3e25. * refactor(Get-Manifest): Select actual source for installed manifest * rework sub-commands, `scoop-depends` is NOT working at this stage * URI manifest * opt * deprecated manifest * source of manifests * source of manifest pt2 - Mark URI(path/URL/UNC/etc.) query as standalone manifest - Drop `installed` and `available update` items for [query] and [installed] are different sources. * remove variable preventing I forget it * scoop-info: fix source of manifest on bucket * fix `scoop-depends` * Fix Standalone and Source detection * fix global install * Fix scoop-cat, scoop-home - Query for remote manifest * scoop-list: info +deprecated * manifest: Fix first selected manifest * gramma.. * Fix61b3259* length * fix(scoop-depends-tests): Mocking `USE_EXTERNAL_7ZIP` as $false (#6431) * fix(scoop-depends-tests): Mocking `USE_EXTERNAL_7ZIP` as $false to avoding error when it is $true * CHANGELOG * feat(autoupdate): GitHub predefined hashes support (#6416) * feat(autoupdate): predefined hash case for GitHub - Remove `sha256:` prefix in `format_hash()` - Add GitHub support in `get_hash_for_app()` Close #6381 * doc(chglog): GitHub auto hash update * fix(autoupdate): remove prefix only * docs(CHANGELOG): Update to 0.5.3 (#6432) * docs(CHANGELOG): Update to 0.5.3 * 6416 --------- Signed-off-by: Chawye Hsu <su+git@chawyehsu.com> Co-authored-by: Olav Rønnestad Birkeland <6450056+o-l-a-v@users.noreply.github.com> Co-authored-by: kiennq <kien.n.quang@gmail.com> Co-authored-by: HUMORCE <humorce@outlook.com> Co-authored-by: Ryan <sitiom@proton.me> Co-authored-by: Chawye Hsu <su+git@chawyehsu.com> Co-authored-by: Bassel Rachid <101208715+basselworkforce@users.noreply.github.com> Co-authored-by: Wordless Echo <wordless@echo.moe>
103 lines
3.5 KiB
PowerShell
103 lines
3.5 KiB
PowerShell
BeforeAll {
|
|
. "$PSScriptRoot\Scoop-TestLib.ps1"
|
|
. "$PSScriptRoot\..\lib\core.ps1"
|
|
. "$PSScriptRoot\..\lib\system.ps1"
|
|
. "$PSScriptRoot\..\lib\manifest.ps1"
|
|
. "$PSScriptRoot\..\lib\install.ps1"
|
|
}
|
|
|
|
Describe 'appname_from_url' -Tag 'Scoop' {
|
|
It 'should extract the correct name' {
|
|
appname_from_url 'https://example.org/directory/foobar.json' | Should -Be 'foobar'
|
|
}
|
|
}
|
|
|
|
Describe 'is_in_dir' -Tag 'Scoop', 'Windows' {
|
|
It 'should work correctly' {
|
|
is_in_dir 'C:\test' 'C:\foo' | Should -BeFalse
|
|
is_in_dir 'C:\test' 'C:\test\foo\baz.zip' | Should -BeTrue
|
|
is_in_dir "$PSScriptRoot\..\" "$PSScriptRoot" | Should -BeFalse
|
|
}
|
|
}
|
|
|
|
Describe 'env add and remove path' -Tag 'Scoop', 'Windows' {
|
|
BeforeAll {
|
|
# test data
|
|
$manifest = @{
|
|
'env_add_path' = @('foo', 'bar', '.', '..')
|
|
}
|
|
$testdir = Join-Path $PSScriptRoot 'path-test-directory'
|
|
$global = $false
|
|
}
|
|
|
|
It 'should concat the correct path' {
|
|
Mock Add-Path {}
|
|
Mock Remove-Path {}
|
|
|
|
# adding
|
|
env_add_path $manifest $testdir $global
|
|
Should -Invoke -CommandName Add-Path -Times 1 -ParameterFilter { $Path -like "$testdir\foo" }
|
|
Should -Invoke -CommandName Add-Path -Times 1 -ParameterFilter { $Path -like "$testdir\bar" }
|
|
Should -Invoke -CommandName Add-Path -Times 1 -ParameterFilter { $Path -like $testdir }
|
|
Should -Invoke -CommandName Add-Path -Times 0 -ParameterFilter { $Path -like $PSScriptRoot }
|
|
|
|
env_rm_path $manifest $testdir $global
|
|
Should -Invoke -CommandName Remove-Path -Times 1 -ParameterFilter { $Path -like "$testdir\foo" }
|
|
Should -Invoke -CommandName Remove-Path -Times 1 -ParameterFilter { $Path -like "$testdir\bar" }
|
|
Should -Invoke -CommandName Remove-Path -Times 1 -ParameterFilter { $Path -like $testdir }
|
|
Should -Invoke -CommandName Remove-Path -Times 0 -ParameterFilter { $Path -like $PSScriptRoot }
|
|
}
|
|
}
|
|
|
|
Describe 'shim_def' -Tag 'Scoop' {
|
|
It 'should use strings correctly' {
|
|
$target, $name, $shimArgs = shim_def 'command.exe'
|
|
$target | Should -Be 'command.exe'
|
|
$name | Should -Be 'command'
|
|
$shimArgs | Should -BeNullOrEmpty
|
|
}
|
|
|
|
It 'should expand the array correctly' {
|
|
$target, $name, $shimArgs = shim_def @('foo.exe', 'bar')
|
|
$target | Should -Be 'foo.exe'
|
|
$name | Should -Be 'bar'
|
|
$shimArgs | Should -BeNullOrEmpty
|
|
|
|
$target, $name, $shimArgs = shim_def @('foo.exe', 'bar', '--test')
|
|
$target | Should -Be 'foo.exe'
|
|
$name | Should -Be 'bar'
|
|
$shimArgs | Should -Be '--test'
|
|
}
|
|
}
|
|
|
|
Describe 'persist_def' -Tag 'Scoop' {
|
|
It 'parses string correctly' {
|
|
$source, $target = persist_def 'test'
|
|
$source | Should -Be 'test'
|
|
$target | Should -Be 'test'
|
|
}
|
|
|
|
It 'should handle sub-folder' {
|
|
$source, $target = persist_def 'foo/bar'
|
|
$source | Should -Be 'foo/bar'
|
|
$target | Should -Be 'foo/bar'
|
|
}
|
|
|
|
It 'should handle arrays' {
|
|
# both specified
|
|
$source, $target = persist_def @('foo', 'bar')
|
|
$source | Should -Be 'foo'
|
|
$target | Should -Be 'bar'
|
|
|
|
# only first specified
|
|
$source, $target = persist_def @('foo')
|
|
$source | Should -Be 'foo'
|
|
$target | Should -Be 'foo'
|
|
|
|
# null value specified
|
|
$source, $target = persist_def @('foo', $null)
|
|
$source | Should -Be 'foo'
|
|
$target | Should -Be 'foo'
|
|
}
|
|
}
|