From 8ca657ec03e802bf12d927f73600fee28b11dff0 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Thu, 12 Apr 2018 11:53:19 -0700 Subject: [PATCH] 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. --- tests/vocabulary.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/vocabulary.rs b/tests/vocabulary.rs index 47231427..125e7ba1 100644 --- a/tests/vocabulary.rs +++ b/tests/vocabulary.rs @@ -605,9 +605,8 @@ fn test_upgrade_with_functions() { let mut row = row.into_iter(); match (row.next(), row.next()) { (Some(TypedValue::Ref(person)), Some(TypedValue::Long(height))) => { - let person = KnownEntid(person); - builder.retract(person, person_height, TypedValue::Long(height))?; - builder.add(person, person_height, TypedValue::Long(inches_to_cm(height)))?; + // No need to explicitly retract: cardinality-one. + builder.add(KnownEntid(person), person_height, TypedValue::Long(inches_to_cm(height)))?; }, _ => {}, } @@ -663,7 +662,7 @@ fn test_upgrade_with_functions() { // 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 /// cleaning up UUIDs). fn lowercase_names(ip: &mut InProgress) -> mentat::errors::Result<()> { @@ -679,10 +678,8 @@ fn test_upgrade_with_functions() { let lowercased = name.to_lowercase(); println!("Need to rename {} from '{}' to '{}'", food, name, lowercased); - let food = KnownEntid(food); let new_name: TypedValue = lowercased.into(); - builder.retract(food, food_name, TypedValue::String(name))?; - builder.add(food, food_name, new_name)?; + builder.add(KnownEntid(food), food_name, new_name)?; } }, _ => {},