-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for
xcodeproj
without Package.resolved
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/install_swiftpm_dependencies/test_scripts/test_project_no_package.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash -eu | ||
|
||
set -o pipefail | ||
|
||
source "$(dirname "${BASH_SOURCE[0]}")/set_up_environment.sh" | ||
|
||
echo "--- :computer: Jump to test folder" | ||
pushd "$TESTS_LOCATION/../project" | ||
|
||
echo "--- :computer: Generate project" | ||
brew install xcodegen | ||
make | ||
|
||
# Notice we do not set up the fixture Package.resolved. | ||
# As such, we expect the call to the plugin to fail. | ||
|
||
echo "--- :wrench: Run install_swiftpm_dependencies" | ||
PROJECT=Demo.xcodeproj | ||
LOGS_PATH=logs | ||
set +e | ||
install_swiftpm_dependencies --project $PROJECT 2>&1 | tee "$LOGS_PATH" | ||
CMD_EXIT_STATUS=$? | ||
set -e | ||
|
||
if [[ $CMD_EXIT_STATUS -eq 0 ]]; then | ||
echo "^^^ install_swiftpm_dependencies unexpectedly succeeded without a Package.resolved in the project folder!" | ||
exit 1 | ||
else | ||
EXPECTED="Unable to find \`Package.resolved\` file ($PROJECT/project.xcworkspace/xcshareddata/swiftpm/Package.resolved)" | ||
if grep -qF "$EXPECTED" "$LOGS_PATH"; then | ||
echo "^^^ +++ install_swiftpm_dependencies failed as expected because there is no Package.resolved in the project folder." | ||
else | ||
echo "+++ install_swiftpm_dependencies failed, but the message it printed is not what we expected." | ||
echo "Expected: $EXPECTED" | ||
echo "Got: $(cat $LOGS_PATH)" | ||
fi | ||
fi |