Sha256: fb7633b928825be8813291bef021f72ae01fea4950bc72896418ca22eba9d70d

Contents?: true

Size: 458 Bytes

Versions: 19

Compression:

Stored size: 458 Bytes

Contents

use magnus::eval;

// this will fail if the allocator calls Ruby, like with rb-sys's
// global-allocator feature
#[test]
fn can_allocate_before_ruby_init() {
    // allocate something
    let x: Vec<i64> = (0..256).collect();

    // *then* init Ruby
    let ruby = unsafe { magnus::embed::init() };

    // do something with allocated data to ensure it's not optimised away
    let res: i64 = eval!(ruby, "x.sum", x).unwrap();
    assert_eq!(res, 32640);
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/allocate_before_init.rs
wasmtime-28.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/allocate_before_init.rs
wasmtime-27.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/allocate_before_init.rs
wasmtime-26.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/allocate_before_init.rs
wasmtime-25.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-25.0.1 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-25.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-24.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-23.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-22.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-21.0.1 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-20.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-20.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/allocate_before_init.rs
wasmtime-18.0.3 ./ext/cargo-vendor/magnus-0.6.2/tests/allocate_before_init.rs
wasmtime-17.0.1 ./ext/cargo-vendor/magnus-0.6.2/tests/allocate_before_init.rs
wasmtime-17.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/allocate_before_init.rs
wasmtime-16.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/allocate_before_init.rs
wasmtime-15.0.1 ./ext/cargo-vendor/magnus-0.6.2/tests/allocate_before_init.rs
wasmtime-15.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/allocate_before_init.rs