-
doesNotThrow(_:file:line:column:function:test:)
Extension methodEmits a passing
TestPoint
if no error will be thrown.tape.test("test does not throw on return", plan: 1) { t in t.doesThrow("does throw is ok when throwing") { return 1 } }
Parameter
Parameter message: The message for the test.Declaration
Swift
public func doesNotThrow<T>( _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function, test: () throws -> T )
Parameters
message
The message for the test.
-
doesNotThrow(_:_:file:line:column:function:test:)
Extension methodEmits a passing
TestPoint
if an error will of another type will be thrown.struct MyError: Error { } struct AnotherError: Error { } tape.test("test does not throw on correct error type", plan: 1) { t in t.doesNotThrow(MyError.self, "does not throw is ok when other type") { throw AnotherError() } }
Parameter
Parameter kind: The kind of errors that are allowed for the test.Parameter
Parameter message: The message for the test.Declaration
Swift
public func doesNotThrow<T, E: Error>( _ kind: E.Type, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function, test: () throws -> T )
Parameters
kind
The kind of errors that are allowed for the test.
message
The message for the test.
-
doesNotThrow(of:_:file:line:column:function:)
Extension methodEmits a passing
TestPoint
if an error will of another type will be thrown.struct MyError: Error { } struct WrongError: Error { } tape.test("error doesn't emit other error'", plan: 1) { t in Observable.error(WrongError()) .test( onNext: t.fail(".error won't emit"), onError: t.doesNotThrow(of: WrongError.self, with: "does not throw wrong type") ) }
Parameter
Parameter kind: The kind of errors that are allowed for the test.Parameter
Parameter message: The message for the test.Declaration
Swift
public func doesNotThrow<E: Error>( of kind: E.Type, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (Error) -> Void
Parameters
kind
The kind of errors that are allowed for the test.
message
The message for the test.
-
doesThrow(_:file:line:column:function:test:)
Extension methodEmits a passing
TestPoint
if an error will be thrown.struct MyError: Error { } tape.test("test does throw on throw", plan: 1) { t in t.doesThrow("does throw is ok when throwing") { throw MyError() } }
Parameter
Parameter message: The message for the test.Declaration
Swift
public func doesThrow<T>( _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function, test: () throws -> T )
Parameters
message
The message for the test.
-
doesThrow(_:_:file:line:column:function:test:)
Extension methodEmits a passing
TestPoint
if an error will of the correct type will be thrown.struct MyError: Error { } tape.test("test does throw on correct error type", plan: 1) { t in t.doesThrow(MyError.self, "does throw is ok when correct type") { throw MyError() } }
Parameter
Parameter kind: The kind of errors that are allowed for the test.Parameter
Parameter message: The message for the test.Declaration
Swift
public func doesThrow<T, E: Error>( _ kind: E.Type, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function, test: () throws -> T )
Parameters
kind
The kind of errors that are allowed for the test.
message
The message for the test.
-
doesThrow(of:with:file:line:column:function:)
Extension methodA curried version of
doesThrow
. Just emits a passingTestPoint
. Useful forObservable
s.struct MyError: Error { } tape.test("observable error emits same error", plan: 1) { t in Observable.error(MyError()) .test( onNext: t.fail(".error won't emit"), onError: t.doesThrow(of: MyError.self, with: "does throw correct type") ) }
Parameter
Parameter kind: The kind of errors that are allowed for the test.Parameter
Parameter message: The message for the test.Declaration
Swift
public func doesThrow<E: Error>( of kind: E.Type, with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (Error) -> Void
Parameters
kind
The kind of errors that are allowed for the test.
message
The message for the test.
-
equal(_:_:_:file:line:column:function:)
Extension methodEmits a
TestPoint
, that passes if both values are equal.tape.test("test equality reflexiveness", plan: 1) { t in t.equal(2, 2, "must be reflexive") }
Parameter
Parameter given: The value to be tested.Parameter
Parameter expected: The value to be compared against.Parameter
Parameter message: The message for the test.Declaration
Swift
public func equal<T: Equatable>( _ given: T, _ expected: T, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
given
The value to be tested.
expected
The value to be compared against.
message
The message for the test.
-
equal(to:_:file:line:column:function:)
Extension methodA curried version of
Test.equal
. Useful forObservable
s.tape.test("just emits", timeout: 0.01) { t in Observable.just(3).test( onNext: t.equal(to: 3, "just emits 3"), onError: t.fail(with: "just won't throw'") ) }
Parameter
Parameter expected: The expected value.Parameter
Parameter message: The message for the test.Declaration
Swift
public func equal<T: Equatable>( to expected: T, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (T) -> Void
Parameters
expected
The expected value.
message
The message for the test.
-
fail(_:file:line:column:function:)
Extension methodJust emits a failing
TestPoint
.tape.test(plan: 1, directive: Directive.todo) { t in t.fail("not implemented") }
Parameter
Parameter message: The message for the test.Declaration
Swift
public func fail( _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
message
The message for the test.
-
fail(with:file:line:column:function:)
Extension methodA curried version of
fail
. Just emits a failingTestPoint
. Useful forObservable
s.tape.test("empty", timeout: 0.01) { t in Observable.empty().test( onNext: t.fail(with: "empty doesn't emit"), onError: t.fail(with: "empty won't throw") ) }
Parameter
Parameter message: The message for the test.Declaration
Swift
public func fail<T>( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (T) -> Void
Parameters
message
The message for the test.
-
notEqual(_:_:message:file:line:column:function:)
Extension methodEmits a
TestPoint
, that passes if both values are not equal.tape.test("test equality", plan: 1) { t in t.notEqual(1, 2, "no false positives") }
Parameter
Parameter message: The message for the test.Declaration
Swift
public func notEqual<T: Equatable>( _ given: T, _ expected: T, message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
message
The message for the test.
-
notEqual(to:message:file:line:column:function:)
Extension methodA curried version of
Test.notEqual
. Useful forObservable
s.tape.test("just emits", timeout: 0.01) { t in Observable.just(3) .map { $0 + 1 } .test( onNext: t.notEqual(to: 3, "just emits 3"), onError: t.fail(with: "just won't throw'") ) }
Parameter
Parameter expected: The expected value.Parameter
Parameter message: The message for the test.Declaration
Swift
public func notEqual<T: Equatable>( to expected: T, message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (T) -> Void
Parameters
expected
The expected value.
message
The message for the test.
-
notOk(_:_:file:line:column:function:)
Extension methodEmits a passing
TestPoint
if test is false.tape.test("test array is not empty", plan: 1) { t in t.notOk([1].isEmpty, "[1] is not empty") }
Parameter
Parameter test: The value to be tested.Parameter
Parameter message: The message for the test.Declaration
Swift
public func notOk( _ test: Bool, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
test
The value to be tested.
message
The message for the test.
-
notOk(_:_:file:line:column:function:)
Extension methodEmits a passing
TestPoint
if test is nil.tape.test("test empty array first", plan: 1) { t in t.notOk([].first, "[] has no first") }
Parameter
Parameter test: The value to be tested.Parameter
Parameter message: The message for the test.Declaration
Swift
public func notOk<T>( _ test: T?, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
test
The value to be tested.
message
The message for the test.
-
notOk(with:file:line:column:function:matches:)
Extension methodA curried version of
Test.notOk
. Useful forObservable
s.tape.test("first emits once", timeout: 0.01) { t in Observable.of(0, 1).first.test( onNext: t.notOk(matches: { $0 >= 0 }), onError: t.fail(with: "of().first won't throw'") ) }
Parameter
Parameter message: The message for the test.Parameter
Parameter predicate: The predicate for the value.Declaration
Swift
public func notOk<T>( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function, matches predicate: @escaping (T) -> Bool ) -> (T) -> Void
Parameters
message
The message for the test.
predicate
The predicate for the value.
-
notOk(with:file:line:column:function:)
Extension methodA curried version of
Test.ok
. Useful forObservable
s.tape.test("first emits once", timeout: 0.01) { t in Observable.of(false, true).first.test( onNext: t.notOk(with: "only emits false"), onError: t.fail(with: "of().first won't throw'") ) }
Parameter
Parameter message: The message for the test.Parameter
Parameter predicate: The predicate for the value.Declaration
Swift
public func notOk( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (Bool) -> Void
Parameters
message
The message for the test.
predicate
The predicate for the value.
-
notOk(with:file:line:column:function:)
Extension methodA curried version of
Test.notOk
. Useful forObservable
s.tape.test("first emits once", timeout: 0.01) { t in Observable.of(nil, 1).first.test( onNext: t.notOk(with: "won't emit nil"), onError: t.fail(with: "of().first won't throw'") ) }
Parameter
Parameter message: The message for the test.Parameter
Parameter predicate: The predicate for the value.Declaration
Swift
public func notOk<T>( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (T?) -> Void
Parameters
message
The message for the test.
predicate
The predicate for the value.
-
ok(_:_:file:line:column:function:)
Extension methodEmits a passing
TestPoint
if test is true.tape.test("test array is empty", plan: 1) { t in t.ok([].isEmpty, "[] is empty") }
Parameter
Parameter test: The value to be tested.Parameter
Parameter message: The message for the test.Declaration
Swift
public func ok( _ test: Bool, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
test
The value to be tested.
message
The message for the test.
-
ok(_:_:file:line:column:function:)
Extension methodEmits a passing
TestPoint
if test is not nil.tape.test("test array first", plan: 1) { t in t.ok([1].first, "[1] has first") }
Parameter
Parameter test: The value to be tested.Parameter
Parameter message: The message for the test.Declaration
Swift
public func ok<T>( _ test: T?, _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
test
The value to be tested.
message
The message for the test.
-
ok(with:file:line:column:function:matches:)
Extension methodA curried version of
Test.ok
. Useful forObservable
s.tape.test("first emits once", timeout: 0.01) { t in Observable.of(1, 0).first.test( onNext: t.ok(matches: { $0 >= 0 }), onError: t.fail(with: "of().first won't throw'") ) }
Parameter
Parameter message: The message for the test.Parameter
Parameter predicate: The predicate for the value.Declaration
Swift
public func ok<T>( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function, matches predicate: @escaping (T) -> Bool ) -> (T) -> Void
Parameters
message
The message for the test.
predicate
The predicate for the value.
-
ok(with:file:line:column:function:)
Extension methodA curried version of
Test.ok
. Useful forObservable
s.tape.test("first emits once", timeout: 0.01) { t in Observable.of(true, false).first.test( onNext: t.ok(with: "only emits true"), onError: t.fail(with: "of().first won't throw'") ) }
Parameter
Parameter message: The message for the test.Parameter
Parameter predicate: The predicate for the value.Declaration
Swift
public func ok( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (Bool) -> Void
Parameters
message
The message for the test.
predicate
The predicate for the value.
-
ok(with:file:line:column:function:)
Extension methodA curried version of
Test.ok
. Useful forObservable
s.tape.test("first emits once", timeout: 0.01) { t in Observable.of(1, nil).first.test( onNext: t.ok(with: "won't emit nil"), onError: t.fail(with: "of().first won't throw'") ) }
Parameter
Parameter message: The message for the test.Parameter
Parameter predicate: The predicate for the value.Declaration
Swift
public func ok<T>( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (T?) -> Void
Parameters
message
The message for the test.
predicate
The predicate for the value.
-
pass(_:file:line:column:function:)
Extension methodJust emits a passing
TestPoint
.tape.test(plan: 1) { t in t.pass() }
Parameter
Parameter message: The message for the test.Declaration
Swift
public func pass( _ message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function )
Parameters
message
The message for the test.
-
pass(with:file:line:column:function:)
Extension methodA curried version of
pass
. Just emits a passingTestPoint
. Useful forObservable
s.tape.test("just emits", timeout: 0.01) { t in Observable.just(3).test( onNext: t.pass(with: "just emits"), onError: t.fail(with: "just won't throw'") ) }
Parameter
Parameter message: The message for the test.Declaration
Swift
public func pass<T>( with message: String? = nil, file: String = #file, line: Int = #line, column: Int = #column, function: String = #function ) -> (T) -> Void
Parameters
message
The message for the test.