46 lines
No EOL
1.3 KiB
Rust
46 lines
No EOL
1.3 KiB
Rust
//! Unit tests migrated from src/basic/keywords/book.rs
|
|
//! These tests were originally in botserver and have been migrated to bottest.
|
|
|
|
#![allow(unused_imports)]
|
|
#![allow(unused_variables)]
|
|
#![allow(dead_code)]
|
|
// Original: use super::*; - tests used internal functions from botserver
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_parse_time_string() {
|
|
let result = parse_time_string("2024-01-15 14:30");
|
|
assert!(result.is_ok());
|
|
|
|
let result = parse_time_string("tomorrow at 3pm");
|
|
assert!(result.is_ok());
|
|
|
|
let result = parse_time_string("in 2 hours");
|
|
assert!(result.is_ok());
|
|
}
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_parse_date_string() {
|
|
let result = parse_date_string("today");
|
|
assert!(result.is_ok());
|
|
|
|
let result = parse_date_string("2024-01-15");
|
|
assert!(result.is_ok());
|
|
|
|
let result = parse_date_string("tomorrow");
|
|
assert!(result.is_ok());
|
|
}
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_extract_hour() {
|
|
assert_eq!(extract_hour_from_string("3pm"), Some(15));
|
|
assert_eq!(extract_hour_from_string("3 PM"), Some(15));
|
|
assert_eq!(extract_hour_from_string("10am"), Some(10));
|
|
assert_eq!(extract_hour_from_string("12am"), Some(0));
|
|
assert_eq!(extract_hour_from_string("12pm"), Some(12));
|
|
} |