bottest/tests/unit/basic/basic_keywords_use_website.rs

42 lines
815 B
Rust
Raw Normal View History

2025-12-23 18:41:29 -03:00
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
use rhai::Dynamic;
use rhai::Engine;
2025-12-23 18:41:29 -03:00
#[test]
2025-12-23 18:41:29 -03:00
fn test_url_sanitization() {
assert_eq!(
sanitize_url_for_collection("https://docs.example.com/path"),
"docs_example_com_path"
);
assert_eq!(
sanitize_url_for_collection("http://test.site:8080"),
"test_site_8080"
);
}
#[test]
2025-12-23 18:41:29 -03:00
fn test_use_website_syntax() {
let mut engine = Engine::new();
2025-12-23 18:41:29 -03:00
assert!(engine
.register_custom_syntax(&["USE_WEBSITE", "$expr$"], true, |_, _| Ok(Dynamic::UNIT))
.is_ok());
2025-12-23 18:41:29 -03:00
assert!(engine
.register_custom_syntax(&["CLEAR_WEBSITES"], true, |_, _| Ok(Dynamic::UNIT))
.is_ok());
}