Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//===----------------------------------------------------------------------===//

/// Visibility level of an argument's help.
public struct ArgumentVisibility {
public struct ArgumentVisibility: Hashable {
/// Internal implementation of `ArgumentVisibility` to allow for easier API
/// evolution.
internal enum Representation {
Expand Down
16 changes: 11 additions & 5 deletions Sources/ArgumentParserTestHelpers/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

@testable import ArgumentParser
import ArgumentParser
import ArgumentParserToolInfo
import XCTest

Expand Down Expand Up @@ -122,15 +122,18 @@ public func AssertHelp<T: ParsableArguments>(
let flag: String
let includeHidden: Bool

switch visibility.base {
switch visibility {
case .default:
flag = "--help"
includeHidden = false
case .hidden:
flag = "--help-hidden"
includeHidden = true
case .private:
XCTFail("Should not be called.")
XCTFail("Should not be called.", file: file, line: line)
return
default:
XCTFail("Unrecognized visibility.", file: file, line: line)
return
}

Expand Down Expand Up @@ -158,13 +161,16 @@ public func AssertHelp<T: ParsableCommand, U: ParsableCommand>(
) {
let includeHidden: Bool

switch visibility.base {
switch visibility {
case .default:
includeHidden = false
case .hidden:
includeHidden = true
case .private:
XCTFail("Should not be called.")
XCTFail("Should not be called.", file: file, line: line)
return
default:
XCTFail("Unrecognized visibility.", file: file, line: line)
return
}

Expand Down