Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Fewer comments in the release script and the new test helpers

Țugui Dragoș9f87443cca4f
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FolderWatchTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FolderWatchTests.swift
index dba4a1de..57498c54 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/FolderWatchTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/FolderWatchTests.swift
@@ -29,8 +29,7 @@ struct FolderWatchTests {
/// The control: without this, a watcher that reported constantly would pass the tests above.
@Test func staysSilentWhileNothingHappens() async throws {
let directory = try TemporaryDirectory()
- // macOS reports a change a moment after it happens. The fixture's own change is heard by a watch of its
- // own first, so the watch under test, which begins after it, cannot hear it as its first change.
+ // The fixture's own change is heard first, so the watch under test cannot take it for its first.
let setup = FolderWatch.changes(in: [directory.url])
try directory.directory("watched/Untouched.app")
try #require(await firstChange(of: setup, within: .seconds(10)), "the fixture's own change was never heard")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PermissionsHold.swift b/Packages/PeelCore/Tests/PeelCoreTests/PermissionsHold.swift
index 866bbd49..b8a7f8b4 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/PermissionsHold.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/PermissionsHold.swift
@@ -2,7 +2,6 @@ import Darwin
import Testing
extension Trait where Self == ConditionTrait {
- /// For a test that takes permissions away. Root ignores them, so under root such a test would check nothing.
static var permissionsHold: Self {
.disabled(if: geteuid() == 0, "root ignores file permissions, which this test takes away")
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SubprocessTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SubprocessTests.swift
index bb5caaac..b6daf7cf 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/SubprocessTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/SubprocessTests.swift
@@ -76,8 +76,6 @@ struct SubprocessTests {
#expect(await task.value == .failure(.canceled))
}
- /// Runs a tool that says it has started and then sleeps for ten minutes, and returns once it has said so, so
- /// that a cancel reaches a tool that runs rather than one not started yet.
private func sleeping(
timeout: TimeInterval?
) async throws -> Task<Result<Subprocess.Output, Subprocess.Failure>, Never> {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/TemporaryDirectory.swift b/Packages/PeelCore/Tests/PeelCoreTests/TemporaryDirectory.swift
index 376590b9..e5ae85cc 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/TemporaryDirectory.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/TemporaryDirectory.swift
@@ -57,8 +57,6 @@ struct TemporaryDirectory: ~Copyable {
try setPermissions(permissions, of: url.appending(path: path))
}
- /// Root ignores permissions, so a test that takes the owner's read or write away carries `.permissionsHold`,
- /// and one that does not fails under root rather than passing for the wrong reason.
func setPermissions(_ permissions: Int, of item: URL) throws {
if geteuid() == 0, permissions & 0o600 != 0o600 {
Issue.record("this test takes permissions away, which root ignores, so it needs .permissionsHold")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
index cc606339..16192baf 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
@@ -613,9 +613,8 @@ struct TrashServiceTests {
}
}
- /// A folder refused by its name is refused before anything inside it is read, since the checks that look a
- /// level or two down cost a read of every folder there. Listing a folder moves its access time when that time
- /// is older than its last change, which `stat` does not, so a folder set back to 2000 tells whether it was read.
+ /// A folder refused by its name is refused before anything inside it is read. Listing a folder moves an old
+ /// access time and `stat` does not, so each folder's access time tells whether it was read.
@Test func refusesByNameBeforeReadingWhatIsInside() throws {
let directory = try TemporaryDirectory()
let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
diff --git a/Scripts/release.sh b/Scripts/release.sh
index df61556f..bc74abaf 100755
--- a/Scripts/release.sh
+++ b/Scripts/release.sh
@@ -21,7 +21,6 @@ export_directory="$build/export"
app="$export_directory/Peel.app"
echo "== The tree"
-# A release is built from what is committed, so what ships is what the history holds.
if [ -n "$(git status --porcelain)" ]; then
git status --short
echo "REFUSED: the working tree has changes. Commit them or set them aside first."
@@ -127,7 +126,6 @@ echo "== Checks"
codesign --verify --deep --strict --verbose=2 "$app"
spctl -a -vvv -t exec "$app"
xcrun stapler validate "$app"
-# The checks macOS runs before it opens an app downloaded from the web (syspolicy_check(1)): 0 when it would open.
if ! syspolicy_check distribution "$app"; then
echo "REFUSED: macOS would not open this app as it is."
exit 1