Skip to content

Conversation

etcwilde
Copy link
Member

The withMockedHome function was swallowing errors from the function under test. This meant that invocations of Swiftly that should have resulted in a test failure would silently pass. e.g. swiftly uninstall 1.2.4 4.5.6 as a test case would pass, even though Swiftly was emitting an error.

There were a couple of cases where this behavior was being relied on for the UseTests to verify that switching to a non-existent toolchain version wouldn't change things from the selected version. In those cases, we want to swallow the error.

The code was silently swallowing errors coming from the function under
test, so errors in the tests did not surface as test failures.
This throws the error if the cleaning the bin directory doesn't fail
first.
Now that the mock home directory isn't swallowing function errors, these
are resulting in test failures when they aren't actually intended.
In these cases, we use `#expect` to verify the version, but swallow any
errors returned by the swiftly invocation.

In all cases, these were the result of trying to switch to a toolchain
that didn't exist. This should emit an error message, but leave the
selected toolchain unchanged.
@cmcgee1024
Copy link
Member

praise: great catch!

@etcwilde etcwilde merged commit 1a26c0e into swiftlang:main Sep 24, 2025
22 of 24 checks passed
@etcwilde etcwilde deleted the ewilde/let-tested-functions-fail branch September 24, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants