zircon/system/ulib/fs/journal/test/journal_test.cc
// Tests that Sync operations are flushed if the journal is destroyed.
Tests that Sync operations are flushed if the journal is destroyed.
Tests that Sync operations are flushed if the journal is destroyed .
TEST_F(JournalTest, NoWorkSyncCompletesOnDestruction) {
  bool sync_completed = false;
  {
    MockTransactionHandler handler(registry());
    Journal journal(&handler, take_info(), take_journal_buffer(), take_data_buffer(), 0,
                    Journal::Options());
    auto promise = journal.Sync().and_then([&] {
      sync_completed = true;
      return fit::ok();
    });
    ASSERT_FALSE(sync_completed);
    journal.schedule_task(std::move(promise));
  }
  ASSERT_TRUE(sync_completed);
}
TEST_F ( JournalTest , NoWorkSyncCompletesOnDestruction ) { bool sync_completed = false ; { MockTransactionHandler handler ( registry ( ) ) ; Journal journal ( & handler , take_info ( ) , take_journal_buffer ( ) , take_data_buffer ( ) , 0 , Journal :: Options ( ) ) ; auto promise = journal . Sync ( ) . and_then ( [ & ] { sync_completed = true ; return fit :: ok ( ) ; } ) ; ASSERT_FALSE ( sync_completed ) ; journal . schedule_task ( std :: move ( promise ) ) ; } ASSERT_TRUE ( sync_completed ) ; }
Tests that Sync operations are flushed if the journal is destroyed.
Tests that Sync operations are flushed if the journal is destroyed .