Altered populate function.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
@@ -13,7 +13,7 @@ fn can_delete() {
|
||||
let mut mtt = MoreThanText::new();
|
||||
let test_doc = TestDocument::new(vec![FieldType::StaticString]);
|
||||
mtt.create_document(test_doc.get_docdef()).unwrap();
|
||||
test_doc.populate(&mut mtt, vec![data]);
|
||||
test_doc.populate(mtt.clone(), vec![data]);
|
||||
let delete = Delete::new(test_doc.get_doc_name());
|
||||
let result = mtt.records(delete).unwrap();
|
||||
assert_eq!(result.len(), 1);
|
||||
@@ -133,7 +133,7 @@ fn does_delete_update_indexes() {
|
||||
let mut docdef = test_doc.get_docdef();
|
||||
docdef.add_index(&test_doc.get_field_name(0), IndexType::Unique);
|
||||
mtt.create_document(docdef).unwrap();
|
||||
test_doc.populate(&mut mtt, vec![id]);
|
||||
test_doc.populate(mtt.clone(), vec![id]);
|
||||
mtt.records(Delete::new(test_doc.get_doc_name())).unwrap();
|
||||
let mut add = Addition::new(test_doc.get_doc_name());
|
||||
add.add_field(test_doc.get_field_name(0), id);
|
||||
|
||||
@@ -157,7 +157,7 @@ fn can_query_use_multiple_fields() {
|
||||
vec!["b", "a"],
|
||||
vec!["b", "b"],
|
||||
];
|
||||
test_doc.populate_multiple(&mut mtt, input);
|
||||
test_doc.populate_multiple(mtt.clone(), input);
|
||||
let mut calc1 = Calculation::new(Operand::Equal);
|
||||
calc1.add_value("a").unwrap();
|
||||
calc1
|
||||
@@ -196,7 +196,7 @@ fn can_query_use_multiple_indexed_fields() {
|
||||
vec!["b", "a"],
|
||||
vec!["b", "b"],
|
||||
];
|
||||
test_doc.populate_multiple(&mut mtt, input);
|
||||
test_doc.populate_multiple(mtt.clone(), input);
|
||||
let mut calc1 = Calculation::new(Operand::Equal);
|
||||
calc1.add_value("a").unwrap();
|
||||
calc1
|
||||
@@ -232,7 +232,7 @@ fn can_query_use_multiple_mixed_index_fields() {
|
||||
vec!["b", "a"],
|
||||
vec!["b", "b"],
|
||||
];
|
||||
test_doc.populate_multiple(&mut mtt, input);
|
||||
test_doc.populate_multiple(mtt.clone(), input);
|
||||
let mut calc1 = Calculation::new(Operand::Equal);
|
||||
calc1.add_value("a").unwrap();
|
||||
calc1
|
||||
|
||||
@@ -15,7 +15,7 @@ pub fn setup_range(count: usize) -> (TestMoreThanText, TestDocument) {
|
||||
let holder: i128 = i.try_into().unwrap();
|
||||
data.push(vec![holder]);
|
||||
}
|
||||
test_doc.populate_multiple(&mut mtt, data);
|
||||
test_doc.populate_multiple(mtt.clone(), data);
|
||||
(test_env, test_doc)
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ impl TestDocument {
|
||||
self.field_names[position].clone()
|
||||
}
|
||||
|
||||
pub fn populate<F>(&self, mtt: &mut MoreThanText, data: Vec<F>)
|
||||
pub fn populate<F>(&self, mut mtt: MoreThanText, data: Vec<F>)
|
||||
where
|
||||
F: Into<Field> + Clone,
|
||||
{
|
||||
@@ -63,7 +63,7 @@ impl TestDocument {
|
||||
self.populate_multiple(mtt, wrapper);
|
||||
}
|
||||
|
||||
pub fn populate_multiple<F>(&self, mtt: &mut MoreThanText, data: Vec<Vec<F>>)
|
||||
pub fn populate_multiple<F>(&self, mut mtt: MoreThanText, data: Vec<Vec<F>>)
|
||||
where
|
||||
F: Into<Field> + Clone,
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ fn can_record_be_added_to_document() {
|
||||
}
|
||||
let test_doc = TestDocument::new(fields);
|
||||
mtt.create_document(test_doc.get_docdef());
|
||||
test_doc.populate(&mut mtt, input);
|
||||
test_doc.populate(mtt.clone(), input);
|
||||
let query = Query::new(test_doc.get_doc_name());
|
||||
let results = mtt.records(query).unwrap();
|
||||
assert_eq!(results.len(), 1);
|
||||
@@ -91,7 +91,7 @@ fn can_document_be_populated_with_multiple_records() {
|
||||
let holder: Vec<i128> = vec![item];
|
||||
data.push(holder);
|
||||
}
|
||||
test_doc.populate_multiple(&mut mtt, data);
|
||||
test_doc.populate_multiple(mtt.clone(), data);
|
||||
let query = Query::new(test_doc.get_doc_name());
|
||||
let results = mtt.records(query).unwrap();
|
||||
assert_eq!(results.len(), count);
|
||||
|
||||
@@ -29,7 +29,7 @@ fn can_a_trigger_cause_an_update() {
|
||||
let mut docdef = test_doc.get_docdef();
|
||||
docdef.add_route(path, function);
|
||||
mtt.create_document(docdef);
|
||||
test_doc.populate(&mut mtt, vec![data0.clone(), data1.clone()]);
|
||||
test_doc.populate(mtt.clone(), vec![data0.clone(), data1.clone()]);
|
||||
let path = Path::new(
|
||||
Include::All,
|
||||
Include::Just(test_doc.get_doc_name().into()),
|
||||
@@ -88,7 +88,7 @@ fn can_trigger_update_specific_record() {
|
||||
let mut docdef = test_doc.get_docdef();
|
||||
docdef.add_route(path, function);
|
||||
mtt.create_document(docdef);
|
||||
test_doc.populate_multiple(&mut mtt, input);
|
||||
test_doc.populate_multiple(mtt.clone(), input);
|
||||
let mut qry_calc = Calculation::new(Operand::Equal);
|
||||
qry_calc
|
||||
.add_value(CalcValue::Existing(FieldType::Integer))
|
||||
@@ -152,7 +152,7 @@ fn can_a_trigger_from_another_document_be_used() {
|
||||
let mut docdef = test_doc.get_docdef();
|
||||
docdef.add_route(path, function);
|
||||
mtt.create_document(docdef);
|
||||
test_doc.populate_multiple(&mut mtt, input);
|
||||
test_doc.populate_multiple(mtt.clone(), input);
|
||||
let path = Path::new(
|
||||
Include::All,
|
||||
Include::Just(test_doc.get_doc_name().into()),
|
||||
|
||||
@@ -35,7 +35,7 @@ fn does_it_update_information() {
|
||||
let mut input: Vec<Field> = Vec::new();
|
||||
input.push(field0.clone().into());
|
||||
input.push("old".into());
|
||||
test_doc.populate(&mut mtt, input);
|
||||
test_doc.populate(mtt.clone(), input);
|
||||
let mut update = Update::new(test_doc.get_doc_name());
|
||||
update.add_field(test_doc.get_field_name(1), field1);
|
||||
let mut calc = Calculation::new(Operand::Equal);
|
||||
@@ -205,7 +205,7 @@ fn does_update_maintain_unique_index() {
|
||||
mtt.create_document(docdef);
|
||||
let old_data = "old";
|
||||
let new_data = "new";
|
||||
test_doc.populate(&mut mtt, vec![old_data]);
|
||||
test_doc.populate(mtt.clone(), vec![old_data]);
|
||||
let mut update = Update::new(test_doc.get_doc_name());
|
||||
update.add_field(test_doc.get_field_name(0), new_data);
|
||||
mtt.records(update).unwrap();
|
||||
@@ -242,7 +242,7 @@ fn does_index_remain_unchanged_on_update_failure() {
|
||||
docdef.add_index(&test_doc.get_field_name(0), IndexType::Unique);
|
||||
mtt.create_document(docdef);
|
||||
let id = "one";
|
||||
test_doc.populate(&mut mtt, vec!["one", "data"]);
|
||||
test_doc.populate(mtt.clone(), vec!["one", "data"]);
|
||||
let mut update = Update::new(test_doc.get_doc_name());
|
||||
update.add_field(test_doc.get_field_name(0), "two");
|
||||
update.add_field(test_doc.get_field_name(1), 2);
|
||||
@@ -270,7 +270,7 @@ fn does_update_error_when_it_overrides_unique_index() {
|
||||
for i in 0..count {
|
||||
input.push(vec![i]);
|
||||
}
|
||||
test_doc.populate_multiple(&mut mtt, input);
|
||||
test_doc.populate_multiple(mtt.clone(), input);
|
||||
let new_data = 5;
|
||||
let mut update = Update::new(test_doc.get_doc_name());
|
||||
update.add_field(test_doc.get_field_name(0), new_data.clone());
|
||||
|
||||
Reference in New Issue
Block a user