pub module class_test; pub class Animal { pub name String; constructor() { self.name = "Rex".to_string(); } pub fn String speak(*self) { "Unknown".to_string() } pub fn void test_speak(*self) { assert_eq!(self.speak(), "Woof!"); } pub fn void static_method() {} } pub class Mammal : Animal { constructor() { super = Super::new(); } pub fn void args_test(*self, x i32, y *str) { assert_eq!(x, 10); assert_eq!(y, "hello"); } } pub class Dog : Mammal { constructor() { super = Super::new(); } pub fn String speak(*self) override(Animal) { "Woof!".to_string() } impl std::fmt::Display { fn Result<(), std::fmt::Error> fmt(*self, f *mut std::fmt::Formatter<'_>) { write!(f, "🐾 {}", self.name) } } } pub fn void run_tests() { let dawg = Dog::new(); dawg.args_test(10, "hello"); dawg.test_speak(); assert_eq!(format!("{dawg}"), "🐾 Rex"); }