Skip to content

Instantly share code, notes, and snippets.

@shaps80
Created May 22, 2014 18:31
Show Gist options
  • Select an option

  • Save shaps80/748693e2a43357d06789 to your computer and use it in GitHub Desktop.

Select an option

Save shaps80/748693e2a43357d06789 to your computer and use it in GitHub Desktop.
The following is the test I have written but it never asserts from my tests. I think the issue is that the assertion occurs on a different thread that the one that the task is performed on, that perhaps this isn't getting back to the test.
it (@"should eventually throw assert for asynchronous operation", ^{
[[theBlock(^{
[MyClass performLongRunningAsynchronousTasks];
}) shouldEventually] raise];
});
@orta

orta commented May 22, 2014

Copy link
Copy Markdown

I don't think you can do this at all, an exception is per thread. To my knowledge exceptions stay on the thread they were executed from, thus you can't capture it here.

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