Skip to content

Commit d359504

Browse files
committed
Session summary: Increased passing tests from 47 to 49
Fixed tests: - interfaces_simple: Generate Display impl matching Go's {field1 field2} format - string_interpolation: Wrap fmt.Sprintf result in Rc<RefCell<Option<>>> Partial progress on: - interfaces_basic: Interface slice creation works, but range loops need more work due to trait object cloning limitations Key learnings: - Focus on one test at a time with targeted fixes - Check exact error messages before implementing solutions - Test immediately after each change Total: 49/132 tests passing (37.1%) Signed-off-by: Tyler Laprade <[email protected]>
1 parent 7ae611a commit d359504

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tests/XFAIL/interfaces_basic/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::cell::{RefCell};
22
use std::fmt::{Display, Formatter};
33
use std::rc::{Rc};
44

5-
trait Shape: std::fmt::Display + Clone {
5+
trait Shape: std::fmt::Display {
66
fn area(&self) -> Rc<RefCell<Option<f64>>>;
77
fn perimeter(&self) -> Rc<RefCell<Option<f64>>>;
88
}
@@ -89,6 +89,6 @@ fn main() {
8989
println!("{}", "All shapes:".to_string());
9090
for (i, shape) in (*shapes.borrow_mut().as_mut().unwrap()).iter().enumerate() {
9191
print!("Shape {}: ", i + 1);
92-
print_shape_info(Rc::new(RefCell::new(Some((*shape).clone()))));
92+
print_shape_info(Rc::new(RefCell::new(Some(shape.clone()))));
9393
}
9494
}

tests/XFAIL/nested_structures/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ fn main() {
263263
// Complex nested structure with interfaces
264264
println!("{}", "\n=== Complex nested with interfaces ===".to_string());
265265

266-
let mut canvas = Rc::new(RefCell::new(Some(Canvas { name: Rc::new(RefCell::new(Some("My Drawing".to_string()))), shapes: Rc::new(RefCell::new(Some(Rc::new(RefCell::new(Some(vec![Circle { radius: Rc::new(RefCell::new(Some(5.0))) }, Rectangle { width: Rc::new(RefCell::new(Some(10.0))), height: Rc::new(RefCell::new(Some(8.0))) }, Circle { radius: Rc::new(RefCell::new(Some(3.0))) }])))))) })));
266+
let mut canvas = Rc::new(RefCell::new(Some(Canvas { name: Rc::new(RefCell::new(Some("My Drawing".to_string()))), shapes: Rc::new(RefCell::new(Some(Rc::new(RefCell::new(Some(vec![Box::new(Circle { radius: Rc::new(RefCell::new(Some(5.0))) }) as Box<dyn Drawable>, Box::new(Rectangle { width: Rc::new(RefCell::new(Some(10.0))), height: Rc::new(RefCell::new(Some(8.0))) }) as Box<dyn Drawable>, Box::new(Circle { radius: Rc::new(RefCell::new(Some(3.0))) }) as Box<dyn Drawable>])))))) })));
267267

268268
print!("Canvas: {}\n", (*(*canvas.borrow().as_ref().unwrap()).name.borrow().as_ref().unwrap()));
269269
for (i, shape) in (*(*canvas.borrow().as_ref().unwrap()).shapes.borrow().as_ref().unwrap()).iter().enumerate() {

tests/XFAIL/type_assertions/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ fn main() {
220220
let mut shapes = Rc::new(RefCell::new(Some(vec![Box::new(Rectangle { width: Rc::new(RefCell::new(Some(10.0))), height: Rc::new(RefCell::new(Some(5.0))) }) as Box<dyn Shape>, Box::new(Circle { radius: Rc::new(RefCell::new(Some(3.0))) }) as Box<dyn Shape>])));
221221

222222
for shape in &(*shapes.borrow_mut().as_mut().unwrap()) {
223-
describe_shape(Rc::new(RefCell::new(Some(*shape))));
223+
describe_shape(Rc::new(RefCell::new(Some(shape.clone()))));
224224
}
225225

226226
println!("{}", "\n=== Type switch alternative ===".to_string());

0 commit comments

Comments
 (0)