-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
140 additions
and
27 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
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
35 changes: 35 additions & 0 deletions
35
Packages/SublimationService/Tests/SublimationServiceTests/ServiceTests.swift
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,35 @@ | ||
// | ||
// ServiceTests.swift | ||
// SublimationService | ||
// | ||
// Created by Leo Dion on 7/30/24. | ||
// | ||
|
||
import XCTest | ||
|
||
final class ServiceTests: XCTestCase { | ||
|
||
override func setUpWithError() throws { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
func testExample() throws { | ||
// This is an example of a functional test case. | ||
// Use XCTAssert and related functions to verify your tests produce the correct results. | ||
// Any test you write for XCTest can be annotated as throws and async. | ||
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. | ||
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. | ||
} | ||
|
||
func testPerformanceExample() throws { | ||
// This is an example of a performance test case. | ||
self.measure { | ||
// Put the code you want to measure the time of here. | ||
} | ||
} | ||
|
||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,35 @@ | ||
// | ||
// SublimationTests.swift | ||
// Sublimation | ||
// | ||
// Created by Leo Dion on 7/30/24. | ||
// | ||
|
||
import XCTest | ||
|
||
final class SublimationTests: XCTestCase { | ||
|
||
override func setUpWithError() throws { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
func testExample() throws { | ||
// This is an example of a functional test case. | ||
// Use XCTAssert and related functions to verify your tests produce the correct results. | ||
// Any test you write for XCTest can be annotated as throws and async. | ||
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. | ||
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. | ||
} | ||
|
||
func testPerformanceExample() throws { | ||
// This is an example of a performance test case. | ||
self.measure { | ||
// Put the code you want to measure the time of here. | ||
} | ||
} | ||
|
||
} |
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,40 @@ | ||
#!/bin/bash | ||
|
||
# Function to run swift test and handle failures | ||
run_test() { | ||
local dir="$1" | ||
local basename=`realpath $dir | xargs -I{} basename {}` | ||
echo "Running tests in $dir" | ||
(cd "$dir" && swift test) &> "$dir/test_output.log" | ||
if [ $? -ne 0 ]; then | ||
echo "Tests failed in $basename. Check $dir/test_output.log for details." | ||
# Kill all background jobs | ||
kill $(jobs -p) 2>/dev/null | ||
exit 1 | ||
fi | ||
echo "Tests passed in $basename" | ||
} | ||
|
||
# Find all directories containing Swift packages in the specified directory (not subdirectories) | ||
package_dirs=(".") | ||
while IFS= read -r -d $'\0'; do | ||
package_dirs+=("$REPLY") | ||
done < <(find . -mindepth 1 -maxdepth 2 -type d -exec test -e '{}/Package.swift' \; -print0) | ||
|
||
# Run tests in parallel | ||
pids=() | ||
for dir in "${package_dirs[@]}"; do | ||
run_test "$dir" & | ||
pids+=($!) | ||
done | ||
|
||
# Wait for all tests to complete | ||
for pid in "${pids[@]}"; do | ||
wait $pid | ||
if [ $? -ne 0 ]; then | ||
echo "One of the tests failed. Stopping remaining tests." | ||
exit 1 | ||
fi | ||
done | ||
|
||
echo "All tests passed." |