mas/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/DSLTest.swift
Chris Araman b404efffc1 ⬆️ Quick (3.0.1)
2021-02-04 18:26:51 -08:00

39 lines
1.2 KiB
Swift

import XCTest
import Nimble
private func nonThrowingInt() -> Int {
return 1
}
private func throwingInt() throws -> Int {
return 1
}
final class DSLTest: XCTestCase {
func testExpectAutoclosureNonThrowing() throws {
let _: Expectation<Int> = expect(1)
let _: Expectation<Int> = expect(nonThrowingInt())
}
func testExpectAutoclosureThrowing() throws {
let _: Expectation<Int> = expect(try throwingInt())
}
func testExpectClosure() throws {
let _: Expectation<Int> = expect { 1 }
let _: Expectation<Int> = expect { nonThrowingInt() }
let _: Expectation<Int> = expect { try throwingInt() }
let _: Expectation<Int> = expect { () -> Int in 1 }
let _: Expectation<Int> = expect { () -> Int? in 1 }
let _: Expectation<Int> = expect { () -> Int? in nil }
let _: Expectation<Void> = expect { }
let _: Expectation<Void> = expect { () -> Void in }
let _: Expectation<Void> = expect { return }
let _: Expectation<Void> = expect { () -> Void in return }
let _: Expectation<Void> = expect { return () }
let _: Expectation<Void> = expect { () -> Void in return () }
}
}