1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
use js_sys::JsString;
use wasm_bindgen::prelude::*;

#[allow(dead_code)]
#[wasm_bindgen]
pub struct AssertionErrorOptions {
    message: Option<JsString>,
    actual: JsValue,
    expected: JsValue,
    operator: JsString,
}

#[wasm_bindgen]
impl AssertionErrorOptions {
    #[wasm_bindgen(constructor)]
    pub fn new(
        message: Option<JsString>,
        actual: JsValue,
        expected: JsValue,
        operator: JsString,
    ) -> AssertionErrorOptions {
        AssertionErrorOptions {
            message,
            actual,
            expected,
            operator,
        }
    }

    /// If provided, the error message is set to this value.
    #[wasm_bindgen(getter)]
    pub fn message(&self) -> Option<JsString> {
        self.message.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_message(&mut self, value: Option<JsString>) {
        self.message = value;
    }

    /// The actual property on the error instance.
    #[wasm_bindgen(getter)]
    pub fn actual(&self) -> JsValue {
        self.actual.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_actual(&mut self, value: JsValue) {
        self.actual = value;
    }

    /// The expected property on the error instance.
    #[wasm_bindgen(getter)]
    pub fn expected(&self) -> JsValue {
        self.expected.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_expected(&mut self, value: JsValue) {
        self.expected = value;
    }

    /// The operator property on the error instance.
    #[wasm_bindgen(getter)]
    pub fn operator(&self) -> JsString {
        self.operator.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_operator(&mut self, value: JsString) {
        self.operator = value;
    }
}