47 lines
1.3 KiB
Rust
47 lines
1.3 KiB
Rust
/// Quick test of OSIRIS Rhai integration
|
|
///
|
|
/// Run with:
|
|
/// ```bash
|
|
/// cargo run --example test_osiris
|
|
/// ```
|
|
|
|
use runner_rust::engine::osiris::create_osiris_engine;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
println!("🧪 Testing OSIRIS Rhai Engine\n");
|
|
|
|
// Test 1: Create engine
|
|
println!("Test 1: Creating OSIRIS engine...");
|
|
let engine = create_osiris_engine("redis://localhost:6379", 1)?;
|
|
println!("✓ Engine created successfully\n");
|
|
|
|
// Test 2: Run simple script
|
|
println!("Test 2: Running simple script...");
|
|
let script = r#"
|
|
print("Hello from OSIRIS Rhai!");
|
|
|
|
// Create a note
|
|
let note = note("test_notes")
|
|
.title("Test Note")
|
|
.content("This is a test")
|
|
.tag("test", "true");
|
|
|
|
print("Note created: " + note.get_title());
|
|
"#;
|
|
|
|
match engine.eval::<()>(script) {
|
|
Ok(_) => println!("✓ Script executed successfully\n"),
|
|
Err(e) => {
|
|
println!("✗ Script error: {}\n", e);
|
|
println!("Note: This is expected if HeroDB is not running");
|
|
}
|
|
}
|
|
|
|
println!("✅ Tests completed!");
|
|
println!("\nTo run full integration:");
|
|
println!("1. Start HeroDB: cd ../herodb && cargo run --release");
|
|
println!("2. Run: cargo run --example test_osiris");
|
|
|
|
Ok(())
|
|
}
|