artichoke_backend/extn/core/time/
mod.rs1use crate::convert::HeapAllocatedData;
22use crate::extn::prelude::*;
23
24pub mod args;
25pub(in crate::extn) mod mruby;
26pub mod offset;
27pub mod subsec;
28pub(super) mod trampoline;
29
30#[doc(inline)]
31pub use spinoso_time::tzrs::*;
32
33impl HeapAllocatedData for Time {
34 const RUBY_TYPE: &'static str = "Time";
35}
36
37impl From<TimeError> for Error {
38 fn from(error: TimeError) -> Error {
39 ArgumentError::from(format!("{error}")).into()
40 }
41}
42
43#[cfg(test)]
44mod tests {
45 use crate::test::prelude::*;
46
47 const SUBJECT: &str = "Time";
48 const FUNCTIONAL_TEST: &[u8] = include_bytes!("time_functional_test.rb");
49
50 #[test]
51 fn functional() {
52 let mut interp = interpreter();
53 let result = interp.eval(FUNCTIONAL_TEST);
54 unwrap_or_panic_with_backtrace(&mut interp, SUBJECT, result);
55 let result = interp.eval(b"spec");
56 unwrap_or_panic_with_backtrace(&mut interp, SUBJECT, result);
57 }
58}