orbiton/
test_hmr_module.rs

1// Test module for HMR functionality
2// This file can be modified to trigger HMR updates
3
4#[allow(dead_code)] // Used in tests and HMR demonstrations
5pub struct TestComponent {
6    pub value: i32,
7    pub message: String,
8}
9
10#[allow(dead_code)] // Used in tests and HMR demonstrations
11impl TestComponent {
12    pub fn new() -> Self {
13        Self {
14            value: 42,
15            message: "Hello from Orbit HMR!".to_string(),
16        }
17    }
18
19    pub fn update(&mut self, new_value: i32) {
20        self.value = new_value;
21        println!("Component updated with value: {new_value}");
22    }
23
24    pub fn render(&self) -> String {
25        format!(
26            "TestComponent {{ value: {}, message: '{}' }}",
27            self.value, self.message
28        )
29    }
30}
31
32#[cfg(test)]
33mod tests {
34    use super::*;
35
36    #[test]
37    fn test_component_creation() {
38        let component = TestComponent::new();
39        assert_eq!(component.value, 42);
40        assert_eq!(component.message, "Hello from Orbit HMR!");
41    }
42
43    #[test]
44    fn test_component_update() {
45        let mut component = TestComponent::new();
46        component.update(100);
47        assert_eq!(component.value, 100);
48    }
49}