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
use crate::convert::HeapAllocatedData;
use crate::extn::prelude::*;
pub mod args;
pub(in crate::extn) mod mruby;
pub mod offset;
pub mod subsec;
pub(super) mod trampoline;
#[doc(inline)]
pub use spinoso_time::tzrs::*;
impl HeapAllocatedData for Time {
const RUBY_TYPE: &'static str = "Time";
}
impl From<TimeError> for Error {
fn from(error: TimeError) -> Error {
ArgumentError::from(format!("{error}")).into()
}
}
#[cfg(test)]
mod tests {
use crate::test::prelude::*;
const SUBJECT: &str = "Time";
const FUNCTIONAL_TEST: &[u8] = include_bytes!("time_test.rb");
#[test]
fn functional() {
let mut interp = interpreter();
let result = interp.eval(FUNCTIONAL_TEST);
unwrap_or_panic_with_backtrace(&mut interp, SUBJECT, result);
let result = interp.eval(b"spec");
unwrap_or_panic_with_backtrace(&mut interp, SUBJECT, result);
}
}