Files
dioxus/packages/generational-box/tests/reused.rs
T
Jonathan Kelley 0cbcef735f Pre-release 0.6.0-alpha.0 (#2755)
* CI: add docsrs to ci

* add env vars

* no need for tokio things

* whoops, wrong rust nightly

* add swc

* bump crate versions to 0.6.0-alpha.0

* hoist up warnings and shuffle cargo.toml

* update cargos and disable warnings from ci

* attempt fix of aws

* attempt disabling aws_lc_sys globally

* pull in lc-sys

* add fips feature to fix docs

* turn on features for aws-lc-sys on cargo-doc-all

* pass along more args

* fix cfg docs

* fix: flakey gen box test

* fix: doc_cfg in static gen

* dont include readme

* fix error on static gen

* remove random line

* temporarily disable warnings

* simplify axum desktop so it doesnt count as a lib

* fix binstall link

* bump locks

* lock fixes

* revert axum desktop

* dont publish some crates
2024-07-31 22:37:39 -05:00

28 lines
705 B
Rust

//! This test needs to be in its own file such that it doesn't share
//! an address space with the other tests.
//!
//! That will cause random failures on CI.
use generational_box::{Storage, SyncStorage, UnsyncStorage};
#[test]
fn reused() {
fn reused_test<S: Storage<i32>>() {
let first_ptr;
{
let owner = S::owner();
first_ptr = owner.insert(1).raw_ptr();
drop(owner);
}
{
let owner = S::owner();
let second_ptr = owner.insert(1234).raw_ptr();
assert_eq!(first_ptr, second_ptr);
drop(owner);
}
}
reused_test::<UnsyncStorage>();
reused_test::<SyncStorage>();
}