Simplify vocabulary migration test.
We don't need to explicitly retract if the transactor will do it for us -- which it will if an attribute is cardinality-one.
This commit is contained in:
parent
1509d16c3e
commit
8ca657ec03
1 changed files with 4 additions and 7 deletions
|
@ -605,9 +605,8 @@ fn test_upgrade_with_functions() {
|
||||||
let mut row = row.into_iter();
|
let mut row = row.into_iter();
|
||||||
match (row.next(), row.next()) {
|
match (row.next(), row.next()) {
|
||||||
(Some(TypedValue::Ref(person)), Some(TypedValue::Long(height))) => {
|
(Some(TypedValue::Ref(person)), Some(TypedValue::Long(height))) => {
|
||||||
let person = KnownEntid(person);
|
// No need to explicitly retract: cardinality-one.
|
||||||
builder.retract(person, person_height, TypedValue::Long(height))?;
|
builder.add(KnownEntid(person), person_height, TypedValue::Long(inches_to_cm(height)))?;
|
||||||
builder.add(person, person_height, TypedValue::Long(inches_to_cm(height)))?;
|
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
@ -663,7 +662,7 @@ fn test_upgrade_with_functions() {
|
||||||
// Unfortunately, we have "spice" and "Spice"!
|
// Unfortunately, we have "spice" and "Spice"!
|
||||||
//
|
//
|
||||||
|
|
||||||
/// This is a straightforward migration -- retract the old string and add the new one.
|
/// This is a straightforward migration -- replace the old name with the new one.
|
||||||
/// This would be everything we need if we _knew_ there were no collisions (e.g., we were
|
/// This would be everything we need if we _knew_ there were no collisions (e.g., we were
|
||||||
/// cleaning up UUIDs).
|
/// cleaning up UUIDs).
|
||||||
fn lowercase_names(ip: &mut InProgress) -> mentat::errors::Result<()> {
|
fn lowercase_names(ip: &mut InProgress) -> mentat::errors::Result<()> {
|
||||||
|
@ -679,10 +678,8 @@ fn test_upgrade_with_functions() {
|
||||||
let lowercased = name.to_lowercase();
|
let lowercased = name.to_lowercase();
|
||||||
println!("Need to rename {} from '{}' to '{}'", food, name, lowercased);
|
println!("Need to rename {} from '{}' to '{}'", food, name, lowercased);
|
||||||
|
|
||||||
let food = KnownEntid(food);
|
|
||||||
let new_name: TypedValue = lowercased.into();
|
let new_name: TypedValue = lowercased.into();
|
||||||
builder.retract(food, food_name, TypedValue::String(name))?;
|
builder.add(KnownEntid(food), food_name, new_name)?;
|
||||||
builder.add(food, food_name, new_name)?;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
Loading…
Reference in a new issue