Support of expectations of Swift errors throwing #136

Closed
yariksmirnov opened this Issue Jun 15, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@yariksmirnov

Would be great to be able to expect Swift native ErrorType throwing.

@modocache

This comment has been minimized.

Show comment
Hide comment
@modocache

modocache Jun 15, 2015

Member

@yariksmirnov Great idea! Could you give an example of what you'd like to see?

Member

modocache commented Jun 15, 2015

@yariksmirnov Great idea! Could you give an example of what you'd like to see?

@yariksmirnov

This comment has been minimized.

Show comment
Hide comment
@yariksmirnov

yariksmirnov Jun 17, 2015

I've been thinking for sometime. I actually don't know how to implement such feature.
I believe it should look something like this:

In case we test function which accept args.

expect {
    testingFuncWhichThrows(arg1, arg2)
}.toThrow()

And more convenient variant for case when func takes no args.

expect(testingFuncWhichThrows).toThrow()

I've been thinking for sometime. I actually don't know how to implement such feature.
I believe it should look something like this:

In case we test function which accept args.

expect {
    testingFuncWhichThrows(arg1, arg2)
}.toThrow()

And more convenient variant for case when func takes no args.

expect(testingFuncWhichThrows).toThrow()
@jeffh

This comment has been minimized.

Show comment
Hide comment
@jeffh

jeffh Jul 27, 2015

Member

Closed, this has been merged into swift-2.0 / 2.0.0-rc.2.

Member

jeffh commented Jul 27, 2015

Closed, this has been merged into swift-2.0 / 2.0.0-rc.2.

@jeffh jeffh closed this Jul 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment