Skip to content

Commit 94db58f

Browse files
fix: pkg_manifest_minimal example (#1458)
As pointed out #1429, the `pkg_manifest_minimal` example was calling `ComplexClass.greet()` and printing the result, but the function did not return anything. Instead, it was printing in `greet()` function. That was not the original intent. I updated `ComplexClass.greet()` to return the greeting so that the executable can print it. I also added a check in `do_test` to confirm that it was being output properly. All of this was a miss on my part. Thanks to @0xLucasMarcal for pointing this. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 17f923c commit 94db58f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

examples/pkg_manifest_minimal/do_test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ assert_match() {
2424
# Run MyExecutable target
2525
output="$("${bazel}" run //Sources/MyExecutable)"
2626
assert_match "Good morning, World!" "${output}"
27+
assert_match "Olivia .* 30 years old" "${output}"
2728

2829
# Run old-style executable in my_local_package
2930
output="$("${bazel}" run @swiftpkg_my_local_package//:print-greeting)"

examples/pkg_manifest_minimal/third_party/NotThatAmazingModule/Sources/NotThatAmazingModule/NotThatAmazingModule.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class ComplexClass {
1111
self.favoriteColors = favoriteColors
1212
}
1313

14-
public func greet() {
15-
print("Hello, my name is \(name) and I'm \(age) years old.")
14+
public func greet() -> String {
15+
return "Hello, my name is \(name) and I'm \(age) years old."
1616
}
1717

1818
public func addFavoriteColor(color: String) {

0 commit comments

Comments
 (0)