Skip to content

Commit

Permalink
checks variable mutability for challenge: declaring variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodesdev committed Jun 8, 2024
1 parent 9a9dd36 commit a66b961
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions challenges/declaring-variables/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ mod tests {
} else if v == "height" {
assert_eq!(var.value(), Value::Int(5), "Height should be 5");
}
});

// width and height should be defined once
variables_to_exist.iter().for_each(|v| {
assert_eq!(
syntest.count_var("calculate_area", v),
1,
"Variable {v} should be defined once"
);
})

assert_eq!(var.is_mutable(), false, "Variable {v} should be immutable");
});
}
}
1 change: 0 additions & 1 deletion crates/syntest/src/syntest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ impl Syntest {
let used = false;
let mut local_value = None;

println!("{:#?}", local);
if let Pat::Ident(ident) = &local.pat {
let mutable = ident.mutability.is_some();

Expand Down

0 comments on commit a66b961

Please sign in to comment.