Skip to content

Commit eba2944

Browse files
authored
Add basic tests for completion-tool list-{dependencies,snippets} (#8065)
There were not tests covering off these two completion-tool commands. This covers off the happy path for all the `list-*` commands. There are still not tests for the completion-tool `generate-*-script` commands
1 parent 6ae005e commit eba2944

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// swift-tools-version:4.2
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "DeckOfPlayingCards",
6+
products: [
7+
.library(name: "DeckOfPlayingCards", targets: ["DeckOfPlayingCards"]),
8+
],
9+
dependencies: [
10+
.package(path: "../PlayingCard"),
11+
.package(path: "../FisherYates")
12+
],
13+
targets: [
14+
.target(
15+
name: "DeckOfPlayingCards",
16+
dependencies: ["PlayingCard", "FisherYates"],
17+
path: "src"),
18+
]
19+
)

Fixtures/DependencyResolution/External/Complex/deck-of-playing-cards-local/src/Deck.swift

Whitespace-only changes.

Tests/CommandsTests/PackageCommandTests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,20 @@ final class PackageCommandTests: CommandsTestCase {
551551
}
552552
}
553553

554+
func testCompletionToolListSnippets() async throws {
555+
try await fixture(name: "Miscellaneous/Plugins/PluginsAndSnippets") { fixturePath in
556+
let result = try await execute(["completion-tool", "list-snippets"], packagePath: fixturePath)
557+
XCTAssertEqual(result.stdout, "MySnippet\n")
558+
}
559+
}
560+
561+
func testCompletionToolListDependencies() async throws {
562+
try await fixture(name: "DependencyResolution/External/Complex") { fixturePath in
563+
let result = try await execute(["completion-tool", "list-dependencies"], packagePath: fixturePath.appending("deck-of-playing-cards-local"))
564+
XCTAssertEqual(result.stdout, "playingcard\nfisheryates\n")
565+
}
566+
}
567+
554568
func testCompletionToolListExecutables() async throws {
555569
try await fixture(name: "Miscellaneous/MultipleExecutables") { fixturePath in
556570
let result = try await execute(["completion-tool", "list-executables"], packagePath: fixturePath)

0 commit comments

Comments
 (0)