Skip to content

Commit

Permalink
test: Fix panic in zip_with test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwes committed May 14, 2020
1 parent d6920fa commit f2fc254
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
15 changes: 1 addition & 14 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,10 @@ struct TestEffIO;

define_test_type! { TestEffIO A }

struct GluonTestable<F>(F);

impl<F> tensile::Testable for GluonTestable<F>
where
F: Future<Output = Result<(), Error>> + Send + 'static,
{
type Error = Error;

fn test(self) -> tensile::TestFuture<Self::Error> {
tensile::Future(self.0).test()
}
}

fn make_tensile_test(name: String, test: TestFn) -> tensile::Test<Error> {
let mut test = ::std::panic::AssertUnwindSafe(test);
tensile::test(name, {
GluonTestable(::std::panic::AssertUnwindSafe(async move {
tensile::Future(::std::panic::AssertUnwindSafe(async move {
let test = test.call_async(()).await?;
let action = test.vm().get_global("std.test.run_io")?;
let mut action: OwnedFunction<fn(OpaqueValue<RootedThread, TestEffIO>) -> IO<()>> =
Expand Down
4 changes: 2 additions & 2 deletions vm/src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,15 +1260,15 @@ impl ThreadInternal for Thread {
);
e.call_state = ExternCallState::Poll
}
_ => unreachable!("{:#?}", frame.state),
_ => (),
}
}
}
if context.stack.get_frames().len() == 1 {
// Only the top level frame left means that the thread has finished
return Err(Error::Dead).into();
}
context = ready!(context.execute(cx))?.unwrap();
context = ready!(context.execute(cx))?.expect("Resume called on the top frame");
Ok(context).into()
}

Expand Down

0 comments on commit f2fc254

Please sign in to comment.