1
//! Tests for the closure emit guards.
2

            
3
use super::*;
4

            
5
#[test]
6
1
fn a_helper_naming_a_local_outside_its_pool_is_a_compile_error() {
7
1
    let mut emit = FunctionEmitter::new();
8
1
    emit.local_get(7);
9
1
    let owned = [(1, ValType::I32)];
10
1
    assert!(matches!(
11
1
        reject_foreign_locals(&emit, 1, &owned),
12
        Err(Error::Compile(_))
13
    ));
14
1
    let mut own = FunctionEmitter::new();
15
1
    own.local_get(1);
16
1
    assert!(reject_foreign_locals(&own, 1, &owned).is_ok());
17
1
}