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
mod util;
#[cfg(feature = "local-rt")]
mod tests {
use jlrs::prelude::*;
use crate::util::JULIA;
fn extend_lifetime() {
JULIA.with(|handle| {
handle.borrow_mut().with_stack(|mut stack| {
stack.scope(|mut frame| {
let output = frame.output();
frame
.scope(|frame| {
let func = unsafe {
Module::base(&frame)
.global(&frame, "+")
.unwrap()
.as_managed()
};
JlrsResult::Ok(func.root(output))
})
.unwrap();
})
})
})
}
fn has_datatype() {
JULIA.with(|handle| {
handle.borrow_mut().with_stack(|mut stack| {
stack.scope(|frame| {
let func_ty = unsafe {
Module::base(&frame)
.global(&frame, "+")
.unwrap()
.as_managed()
.datatype()
};
assert_eq!(func_ty.name(), "#+");
})
})
})
}
#[test]
fn function_tests() {
extend_lifetime();
has_datatype();
}
}