mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-01 18:01:06 +00:00
Add a test that two mutable borrows is not ok
This commit is contained in:
parent
eebe8b21a2
commit
ebc97438e7
@ -124,6 +124,12 @@ fn exceptions() {
|
|||||||
pub fn new() -> A {
|
pub fn new() -> A {
|
||||||
A {}
|
A {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn foo(&self, _: &A) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn bar(&mut self, _: &mut A) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#)
|
"#)
|
||||||
@ -136,6 +142,14 @@ fn exceptions() {
|
|||||||
a.free();
|
a.free();
|
||||||
// TODO: figure out a better error message?
|
// TODO: figure out a better error message?
|
||||||
assert.throws(() => a.free(), /RuntimeError: unreachable/);
|
assert.throws(() => a.free(), /RuntimeError: unreachable/);
|
||||||
|
|
||||||
|
let b = wasm.A.new();
|
||||||
|
try {
|
||||||
|
b.foo(b);
|
||||||
|
assert.throws(() => b.bar(b), /RuntimeError: unreachable/);
|
||||||
|
} finally {
|
||||||
|
b.free();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"#)
|
"#)
|
||||||
.test();
|
.test();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user