Skip to content

Commit

Permalink
match with starts_with()
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalbel committed Dec 19, 2024
1 parent 4b75dfe commit e99f34c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions crates/ark/src/variables/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1906,10 +1906,11 @@ mod tests {
let vars = PositronVariable::inspect(env.clone(), &path).unwrap();

assert_eq!(vars.len(), 1);
assert_eq!(
vars[0].display_value,
"<S4 class ‘Person’ [package “.GlobalEnv”] with 3 slots>"
);
// Matching equality is not nice because the default `format` method for S4 objects
// uses different quoting characters on Windows vs Unix.
// Unix: <S4 class ‘ddiMatrix’ [package “Matrix”] with 4 slots>
// Windows: <S4 class 'ddiMatrix' [package "Matrix"] with 4 slots>
assert!(vars[0].display_value.starts_with("<S4 class"));

// Inspect the S4 object
let path = vec![String::from("x")];
Expand Down Expand Up @@ -2070,10 +2071,7 @@ mod tests {
let path = vec![];
let vars = PositronVariable::inspect(env.into(), &path).unwrap();
assert_eq!(vars.len(), 1);
assert_eq!(
vars[0].display_value,
"<S4 class ‘ddiMatrix’ [package “Matrix”] with 4 slots>"
);
assert!(vars[0].display_value.starts_with("<S4 class"),);
})
}
}

0 comments on commit e99f34c

Please sign in to comment.