Skip to content

Commit f245342

Browse files
committed
[WIP] Add HelpGenerationTests.testHelpWithPrivate test
1 parent 89974af commit f245342

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Tests/ArgumentParserUnitTests/HelpGenerationTests.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,29 @@ extension HelpGenerationTests {
547547
XCTAssertEqual(AllValues.SpecializedSynthesized.allValueStrings, opts[4].help.allValues)
548548
XCTAssertEqual(AllValues.SpecializedSynthesized.allValueStrings, opts[5].help.allValues)
549549
}
550+
551+
struct Q: ParsableArguments {
552+
@Option(help: "Your name") var name: String
553+
@Option(help: "Your title") var title: String?
554+
555+
@Argument(help: .private) var privateName: String?
556+
@Option(help: .private) var privateTitle: String?
557+
@Flag(help: .private) var privateFlag: Bool = false
558+
@Flag(inversion: .prefixedNo, help: .private) var privateInvertedFlag: Bool = true
559+
}
560+
561+
func testHelpWithPrivate() {
562+
// For now, hidden and private have the same behaviour
563+
AssertHelp(for: Q.self, equals: """
564+
USAGE: q --name <name> [--title <title>]
565+
566+
OPTIONS:
567+
--name <name> Your name
568+
--title <title> Your title
569+
-h, --help Show help information.
570+
571+
""")
572+
}
550573
}
551574

552575
// MARK: - Issue #278 https://github.com/apple/swift-argument-parser/issues/278

0 commit comments

Comments
 (0)