1
use super::*;
2

            
3
#[test]
4
1
fn the_fiber_cap_is_a_resource_stop() {
5
1
    let capped = wasmtime::Error::msg("store limit of fibers has been reached");
6
1
    assert_eq!(classify_runtime_error(&capped), EngineError::FiberLimit);
7
1
    let wrapped = capped.context("error while executing at wasm backtrace");
8
1
    assert_eq!(classify_runtime_error(&wrapped), EngineError::FiberLimit);
9
1
}
10

            
11
#[test]
12
1
fn a_host_condition_with_the_fiber_text_stays_a_host_condition() {
13
1
    let condition = HostCondition {
14
1
        code: "boom".to_string(),
15
1
        message: "store limit of fibers has been reached".to_string(),
16
1
        detail: None,
17
1
    };
18
1
    assert_eq!(
19
1
        classify_runtime_error(&wasmtime::Error::new(condition)),
20
1
        EngineError::ScriptRaised {
21
1
            code: "BOOM".to_string(),
22
1
            message: "store limit of fibers has been reached".to_string(),
23
1
            detail: None,
24
1
        }
25
    );
26
1
}
27

            
28
#[test]
29
1
fn other_messages_stay_traps() {
30
1
    let other = wasmtime::Error::msg("unreachable");
31
1
    assert_eq!(
32
1
        classify_runtime_error(&other),
33
1
        EngineError::Trap("unreachable".to_string())
34
    );
35
1
}
36

            
37
#[test]
38
1
fn the_fiber_cap_maps_to_a_runtime_code() {
39
1
    assert_eq!(
40
1
        err_code_and_message(&EngineError::FiberLimit),
41
1
        ("runtime".to_string(), "fiber limit reached".to_string())
42
    );
43
1
}