Fix formatter bugs

This commit is contained in:
2026-06-26 01:29:51 +02:00
parent e5509e89a4
commit 6c9c0e03d2
13 changed files with 173 additions and 84 deletions
+23 -7
View File
@@ -1,36 +1,52 @@
pub module class_test;
pub class Animal {
pub String name;
constructor() {
self.name = "Rex".to_string();
}
pub String speak(&self) {
"Unknown".to_string()
} pub void test_speak<'a>(&'a self) {
}
pub void test_speak<'a>(&'a self) {
assert_eq!(self.speak(), "Woof!");
} pub void static_method() {
}}
}
pub void static_method() {
}
}
pub class Mammal : Animal {
constructor() {
super = Super::new();
}
pub void args_test(&self, i32 x, str& y) {
assert_eq!(x, 10);
assert_eq!(y, "hello");
}}
}
}
pub class Dog : Mammal {
constructor() {
super = Super::new();
}
pub String speak(&self) override(Animal) {
"Woof!".to_string()
} implstd::fmt::Display {
}
impl std::fmt::Display {
Result<(), std::fmt::Error> fmt(&self, std::fmt::Formatter<'_>& mut f) {
write!(f, "🐾 {}", self.name)
} }
}
}
}
pub void run_tests() {
@@ -38,4 +54,4 @@ pub void run_tests() {
dawg.args_test(10, "hello");
dawg.test_speak();
assert_eq!(format!("{dawg}"), "🐾 Rex");
}
}