()
| 1099 | #[test] |
| 1100 | #[cfg(feature = "component-model")] |
| 1101 | fn component_tables_limit() -> Result<()> { |
| 1102 | let mut pool = crate::small_pool_config(); |
| 1103 | pool.max_tables_per_component(1).total_tables(2); |
| 1104 | let mut config = Config::new(); |
| 1105 | config.wasm_component_model(true); |
| 1106 | config.allocation_strategy(pool); |
| 1107 | let engine = Engine::new(&config)?; |
| 1108 | |
| 1109 | // One table works. |
| 1110 | wasmtime::component::Component::new( |
| 1111 | &engine, |
| 1112 | r#" |
| 1113 | (component |
| 1114 | (core module $m (table 1 1 funcref)) |
| 1115 | (core instance $a (instantiate $m)) |
| 1116 | ) |
| 1117 | "#, |
| 1118 | )?; |
| 1119 | |
| 1120 | // Two tables doesn't. |
| 1121 | match wasmtime::component::Component::new( |
| 1122 | &engine, |
| 1123 | r#" |
| 1124 | (component |
| 1125 | (core module $m (table 1 1 funcref)) |
| 1126 | (core instance $a (instantiate $m)) |
| 1127 | (core instance $b (instantiate $m)) |
| 1128 | ) |
| 1129 | "#, |
| 1130 | ) { |
| 1131 | Ok(_) => panic!("should have hit limit"), |
| 1132 | Err(e) => e.assert_contains( |
| 1133 | "The component transitively contains 2 tables, which exceeds the \ |
| 1134 | configured maximum of 1", |
| 1135 | ), |
| 1136 | } |
| 1137 | |
| 1138 | Ok(()) |
| 1139 | } |
| 1140 | |
| 1141 | #[test] |
| 1142 | #[cfg(feature = "component-model")] |
nothing calls this directly
no test coverage detected