Merge pull request #3 from skelpo/develop

Made Validation protocol extension properties public
This commit is contained in:
Caleb Kleveter 2019-01-17 12:18:50 -06:00 committed by GitHub
commit fde0c8669e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 11 deletions

View File

@ -21,10 +21,10 @@ public protocol LengthValidation: Validation where Supported: Collection {
}
extension LengthValidation {
static var minLength: Int { return 0 }
public static var minLength: Int { return 0 }
/// See `Validation.validate(_:)`.
static func validate(_ value: Supported)throws {
public static func validate(_ value: Supported)throws {
guard value.count <= self.maxLength else {
throw ValidationError(identifier: "lengthTooLong", reason: "Length of collection value is greater than \(self.maxLength)")
}

View File

@ -24,8 +24,8 @@ public protocol InRangeValidation: Validation where Supported: Comparable {
}
extension InRangeValidation {
static var max: Supported? { return nil }
static var min: Supported? { return nil }
public static var max: Supported? { return nil }
public static var min: Supported? { return nil }
/// See `Validation.validate(_:)`.
public static func validate(_ value: Supported)throws {

View File

@ -1,5 +1,5 @@
import XCTest
@testable import Validation
@testable import Failable
final class FailableTests: XCTestCase {
func testInit()throws {

View File

@ -1,5 +1,5 @@
import XCTest
@testable import Validation
@testable import Failable
final class ValidationErrorTests: XCTestCase {
func testInit()throws {

View File

@ -1,5 +1,5 @@
import XCTest
@testable import Validation
@testable import Failable
internal struct EmptyValidation<T>: Validation {
typealias Supported = T

View File

@ -1,5 +1,5 @@
import XCTest
@testable import Validation
@testable import Failable
internal struct LengthRange10To1028<C>: LengthValidation where C: Collection {
typealias Supported = C

View File

@ -1,5 +1,5 @@
import XCTest
@testable import Validation
@testable import Failable
internal struct NumberThousand: InRangeValidation {
typealias Supported = Int

View File

@ -1,5 +1,5 @@
import XCTest
@testable import Validation
@testable import Failable
typealias OptionalStringLength = NotNilValidate<LengthRange10To1028<String>>

View File

@ -1,5 +1,5 @@
import XCTest
@testable import Validation
@testable import Failable
internal struct USPhoneNumber: RegexValidation {
static let pattern = "1?-?\\(?[0-9]{3}\\)?-?[0-9]{3}-?[0-9]{4}"