Merge pull request #3 from skelpo/develop
Made Validation protocol extension properties public
This commit is contained in:
commit
fde0c8669e
|
@ -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)")
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import XCTest
|
||||
@testable import Validation
|
||||
@testable import Failable
|
||||
|
||||
final class FailableTests: XCTestCase {
|
||||
func testInit()throws {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import XCTest
|
||||
@testable import Validation
|
||||
@testable import Failable
|
||||
|
||||
final class ValidationErrorTests: XCTestCase {
|
||||
func testInit()throws {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import XCTest
|
||||
@testable import Validation
|
||||
@testable import Failable
|
||||
|
||||
internal struct EmptyValidation<T>: Validation {
|
||||
typealias Supported = T
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import XCTest
|
||||
@testable import Validation
|
||||
@testable import Failable
|
||||
|
||||
internal struct LengthRange10To1028<C>: LengthValidation where C: Collection {
|
||||
typealias Supported = C
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import XCTest
|
||||
@testable import Validation
|
||||
@testable import Failable
|
||||
|
||||
internal struct NumberThousand: InRangeValidation {
|
||||
typealias Supported = Int
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import XCTest
|
||||
@testable import Validation
|
||||
@testable import Failable
|
||||
|
||||
typealias OptionalStringLength = NotNilValidate<LengthRange10To1028<String>>
|
||||
|
||||
|
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in New Issue