MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / test_initial_table_limits_exceeded

Function test_initial_table_limits_exceeded

tests/all/limits.rs:320–348  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

318
319#[test]
320fn test_initial_table_limits_exceeded() -> Result<()> {
321 let engine = Engine::default();
322 let module = Module::new(&engine, r#"(module (table (export "t") 23 funcref))"#)?;
323
324 let mut store = Store::new(&engine, StoreLimitsBuilder::new().table_elements(4).build());
325 store.limiter(|s| s as &mut dyn ResourceLimiter);
326
327 match Instance::new(&mut store, &module, &[]) {
328 Ok(_) => unreachable!(),
329 Err(e) => assert_eq!(
330 e.to_string(),
331 "table minimum size of 23 elements exceeds table limits"
332 ),
333 }
334
335 match Table::new(
336 &mut store,
337 TableType::new(RefType::FUNCREF, 99, None),
338 Ref::Func(None),
339 ) {
340 Ok(_) => unreachable!(),
341 Err(e) => assert_eq!(
342 e.to_string(),
343 "table minimum size of 99 elements exceeds table limits"
344 ),
345 }
346
347 Ok(())
348}
349
350#[test]
351fn test_pooling_allocator_initial_limits_exceeded() -> Result<()> {

Callers

nothing calls this directly

Calls 6

OkFunction · 0.85
newFunction · 0.50
FuncEnum · 0.50
buildMethod · 0.45
table_elementsMethod · 0.45
limiterMethod · 0.45

Tested by

no test coverage detected