From 6a5faf852d1ca216841828a430e2a7428efdd2d3 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 29 Jan 2022 16:15:30 +0000 Subject: [PATCH] No need for mutable executor in tests --- src/sql/value/array.rs | 8 ++++---- src/sql/value/clear.rs | 8 ++++---- src/sql/value/decrement.rs | 20 +++++++++---------- src/sql/value/del.rs | 40 +++++++++++++++++++------------------- src/sql/value/get.rs | 36 +++++++++++++++++----------------- src/sql/value/increment.rs | 20 +++++++++---------- src/sql/value/object.rs | 8 ++++---- src/sql/value/patch.rs | 32 +++++++++++++++--------------- src/sql/value/replace.rs | 4 ++-- src/sql/value/set.rs | 40 +++++++++++++++++++------------------- 10 files changed, 108 insertions(+), 108 deletions(-) diff --git a/src/sql/value/array.rs b/src/sql/value/array.rs index 6011cef7..5c2e5b1a 100644 --- a/src/sql/value/array.rs +++ b/src/sql/value/array.rs @@ -28,21 +28,21 @@ mod tests { #[tokio::test] async fn array_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::default(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("[]"); - val.array(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.array(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn array_path() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: [] }"); - val.array(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.array(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } } diff --git a/src/sql/value/clear.rs b/src/sql/value/clear.rs index fb956b4c..9c34ebdc 100644 --- a/src/sql/value/clear.rs +++ b/src/sql/value/clear.rs @@ -26,19 +26,19 @@ mod tests { #[tokio::test] async fn clear_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{}"); - val.clear(&ctx, &opt, &mut exe).await.unwrap(); + val.clear(&ctx, &opt, &exe).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn clear_path() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{}"); - val.clear(&ctx, &opt, &mut exe).await.unwrap(); + val.clear(&ctx, &opt, &exe).await.unwrap(); assert_eq!(res, val); } } diff --git a/src/sql/value/decrement.rs b/src/sql/value/decrement.rs index b2f366c4..fae75bdf 100644 --- a/src/sql/value/decrement.rs +++ b/src/sql/value/decrement.rs @@ -44,51 +44,51 @@ mod tests { #[tokio::test] async fn dec_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("other"); let mut val = Value::parse("{ test: 100 }"); let res = Value::parse("{ test: 100, other: -10 }"); - val.decrement(&ctx, &opt, &mut exe, &idi, Value::from(10)).await.unwrap(); + val.decrement(&ctx, &opt, &exe, &idi, Value::from(10)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn dec_number() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: 100 }"); let res = Value::parse("{ test: 90 }"); - val.decrement(&ctx, &opt, &mut exe, &idi, Value::from(10)).await.unwrap(); + val.decrement(&ctx, &opt, &exe, &idi, Value::from(10)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn dec_array_number() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test[1]"); let mut val = Value::parse("{ test: [100, 200, 300] }"); let res = Value::parse("{ test: [100, 190, 300] }"); - val.decrement(&ctx, &opt, &mut exe, &idi, Value::from(10)).await.unwrap(); + val.decrement(&ctx, &opt, &exe, &idi, Value::from(10)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn dec_array_value() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: [100, 200, 300] }"); let res = Value::parse("{ test: [100, 300] }"); - val.decrement(&ctx, &opt, &mut exe, &idi, Value::from(200)).await.unwrap(); + val.decrement(&ctx, &opt, &exe, &idi, Value::from(200)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn dec_array_array() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: [100, 200, 300] }"); let res = Value::parse("{ test: [200] }"); - val.decrement(&ctx, &opt, &mut exe, &idi, Value::parse("[100, 300]")).await.unwrap(); + val.decrement(&ctx, &opt, &exe, &idi, Value::parse("[100, 300]")).await.unwrap(); assert_eq!(res, val); } } diff --git a/src/sql/value/del.rs b/src/sql/value/del.rs index b0725261..24ec9890 100644 --- a/src/sql/value/del.rs +++ b/src/sql/value/del.rs @@ -127,101 +127,101 @@ mod tests { #[tokio::test] async fn del_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::default(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: { other: null, something: 123 } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_reset() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_basic() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: { other: null } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_wrong() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something.wrong"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: { other: null, something: 123 } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_other() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.other.something"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: { other: null, something: 123 } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_array() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[1]"); let mut val = Value::parse("{ test: { something: [123, 456, 789] } }"); let res = Value::parse("{ test: { something: [123, 789] } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_array_field() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[1].age"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ age: 34 }, { }] } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_array_fields() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[*].age"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ }, { }] } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_array_where_field() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[WHERE age > 35].age"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ age: 34 }, { }] } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn del_array_where_fields() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[WHERE age > 35]"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ age: 34 }] } }"); - val.del(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.del(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } } diff --git a/src/sql/value/get.rs b/src/sql/value/get.rs index 0e42e80e..107fc05e 100644 --- a/src/sql/value/get.rs +++ b/src/sql/value/get.rs @@ -97,28 +97,28 @@ mod tests { #[tokio::test] async fn get_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::default(); let val = Value::parse("{ test: { other: null, something: 123 } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn get_basic() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something"); let val = Value::parse("{ test: { other: null, something: 123 } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, Value::from(123)); } #[tokio::test] async fn get_thing() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.other"); let val = Value::parse("{ test: { other: test:tobie, something: 123 } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!( res, Value::from(Thing { @@ -130,19 +130,19 @@ mod tests { #[tokio::test] async fn get_array() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[1]"); let val = Value::parse("{ test: { something: [123, 456, 789] } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, Value::from(456)); } #[tokio::test] async fn get_array_thing() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[1]"); let val = Value::parse("{ test: { something: [test:tobie, test:jaime] } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!( res, Value::from(Thing { @@ -154,37 +154,37 @@ mod tests { #[tokio::test] async fn get_array_field() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[1].age"); let val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, Value::from(36)); } #[tokio::test] async fn get_array_fields() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[*].age"); let val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, Value::from(vec![34, 36])); } #[tokio::test] async fn get_array_where_field() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[WHERE age > 35].age"); let val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, Value::from(vec![36])); } #[tokio::test] async fn get_array_where_fields() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[WHERE age > 35]"); let val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); - let res = val.get(&ctx, &opt, &mut exe, &idi).await.unwrap(); + let res = val.get(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!( res, Value::from(vec![Value::from(map! { diff --git a/src/sql/value/increment.rs b/src/sql/value/increment.rs index 38016ff8..508ad5d5 100644 --- a/src/sql/value/increment.rs +++ b/src/sql/value/increment.rs @@ -45,51 +45,51 @@ mod tests { #[tokio::test] async fn inc_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("other"); let mut val = Value::parse("{ test: 100 }"); let res = Value::parse("{ test: 100, other: +10 }"); - val.increment(&ctx, &opt, &mut exe, &idi, Value::from(10)).await.unwrap(); + val.increment(&ctx, &opt, &exe, &idi, Value::from(10)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn inc_number() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: 100 }"); let res = Value::parse("{ test: 110 }"); - val.increment(&ctx, &opt, &mut exe, &idi, Value::from(10)).await.unwrap(); + val.increment(&ctx, &opt, &exe, &idi, Value::from(10)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn inc_array_number() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test[1]"); let mut val = Value::parse("{ test: [100, 200, 300] }"); let res = Value::parse("{ test: [100, 210, 300] }"); - val.increment(&ctx, &opt, &mut exe, &idi, Value::from(10)).await.unwrap(); + val.increment(&ctx, &opt, &exe, &idi, Value::from(10)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn inc_array_value() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: [100, 200, 300] }"); let res = Value::parse("{ test: [100, 200, 300] }"); - val.increment(&ctx, &opt, &mut exe, &idi, Value::from(200)).await.unwrap(); + val.increment(&ctx, &opt, &exe, &idi, Value::from(200)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn inc_array_array() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: [100, 200, 300] }"); let res = Value::parse("{ test: [100, 200, 300, 400, 500] }"); - val.increment(&ctx, &opt, &mut exe, &idi, Value::parse("[100, 300, 400, 500]")) + val.increment(&ctx, &opt, &exe, &idi, Value::parse("[100, 300, 400, 500]")) .await .unwrap(); assert_eq!(res, val); diff --git a/src/sql/value/object.rs b/src/sql/value/object.rs index 53375752..760f8877 100644 --- a/src/sql/value/object.rs +++ b/src/sql/value/object.rs @@ -28,21 +28,21 @@ mod tests { #[tokio::test] async fn object_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::default(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{}"); - val.object(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.object(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn object_path() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: {} }"); - val.object(&ctx, &opt, &mut exe, &idi).await.unwrap(); + val.object(&ctx, &opt, &exe, &idi).await.unwrap(); assert_eq!(res, val); } } diff --git a/src/sql/value/patch.rs b/src/sql/value/patch.rs index 95c28c2c..f56249e3 100644 --- a/src/sql/value/patch.rs +++ b/src/sql/value/patch.rs @@ -52,85 +52,85 @@ mod tests { #[tokio::test] async fn patch_add_simple() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let ops = Array::parse("[{ op: 'add', path: '/temp', value: true }]"); let res = Value::parse("{ test: { other: null, something: 123 }, temp: true }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn patch_remove_simple() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 }, temp: true }"); let ops = Array::parse("[{ op: 'remove', path: '/temp' }]"); let res = Value::parse("{ test: { other: null, something: 123 } }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn patch_replace_simple() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 }, temp: true }"); let ops = Array::parse("[{ op: 'replace', path: '/temp', value: 'text' }]"); let res = Value::parse("{ test: { other: null, something: 123 }, temp: 'text' }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn patch_change_simple() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 }, temp: 'test' }"); let ops = Array::parse( "[{ op: 'change', path: '/temp', value: '@@ -1,4 +1,4 @@\n te\n-s\n+x\n t\n' }]", ); let res = Value::parse("{ test: { other: null, something: 123 }, temp: 'text' }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn patch_add_embedded() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let ops = Array::parse("[{ op: 'add', path: '/temp/test', value: true }]"); let res = Value::parse("{ test: { other: null, something: 123 }, temp: { test: true } }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn patch_remove_embedded() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 }, temp: true }"); let ops = Array::parse("[{ op: 'remove', path: '/test/other' }]"); let res = Value::parse("{ test: { something: 123 }, temp: true }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn patch_replace_embedded() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 }, temp: true }"); let ops = Array::parse("[{ op: 'replace', path: '/test/other', value: 'text' }]"); let res = Value::parse("{ test: { other: 'text', something: 123 }, temp: true }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn patch_change_embedded() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: 'test', something: 123 }, temp: true }"); let ops = Array::parse( "[{ op: 'change', path: '/test/other', value: '@@ -1,4 +1,4 @@\n te\n-s\n+x\n t\n' }]", ); let res = Value::parse("{ test: { other: 'text', something: 123 }, temp: true }"); - val.patch(&ctx, &opt, &mut exe, &ops).await.unwrap(); + val.patch(&ctx, &opt, &exe, &ops).await.unwrap(); assert_eq!(res, val); } } diff --git a/src/sql/value/replace.rs b/src/sql/value/replace.rs index 2015d8fb..05569596 100644 --- a/src/sql/value/replace.rs +++ b/src/sql/value/replace.rs @@ -28,11 +28,11 @@ mod tests { #[tokio::test] async fn replace() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ other: true }"); let obj = Object::from(map! {String::from("other") => Value::from(true) }); - val.replace(&ctx, &opt, &mut exe, &obj).await.unwrap(); + val.replace(&ctx, &opt, &exe, &obj).await.unwrap(); assert_eq!(res, val); } } diff --git a/src/sql/value/set.rs b/src/sql/value/set.rs index e6668d95..36109323 100644 --- a/src/sql/value/set.rs +++ b/src/sql/value/set.rs @@ -85,101 +85,101 @@ mod tests { #[tokio::test] async fn set_none() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::default(); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("999"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(999)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(999)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_reset() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: 999 }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(999)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(999)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_basic() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: { other: null, something: 999 } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(999)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(999)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_wrong() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something.wrong"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: { other: null, something: 123 } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(999)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(999)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_other() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.other.something"); let mut val = Value::parse("{ test: { other: null, something: 123 } }"); let res = Value::parse("{ test: { other: { something: 999 }, something: 123 } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(999)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(999)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_array() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[1]"); let mut val = Value::parse("{ test: { something: [123, 456, 789] } }"); let res = Value::parse("{ test: { something: [123, 999, 789] } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(999)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(999)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_array_field() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[1].age"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ age: 34 }, { age: 21 }] } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(21)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(21)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_array_fields() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[*].age"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ age: 21 }, { age: 21 }] } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(21)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(21)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_array_where_field() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[WHERE age > 35].age"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ age: 34 }, { age: 21 }] } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(21)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(21)).await.unwrap(); assert_eq!(res, val); } #[tokio::test] async fn set_array_where_fields() { - let (ctx, opt, mut exe) = mock(); + let (ctx, opt, exe) = mock(); let idi = Idiom::parse("test.something[WHERE age > 35]"); let mut val = Value::parse("{ test: { something: [{ age: 34 }, { age: 36 }] } }"); let res = Value::parse("{ test: { something: [{ age: 34 }, 21] } }"); - val.set(&ctx, &opt, &mut exe, &idi, Value::from(21)).await.unwrap(); + val.set(&ctx, &opt, &exe, &idi, Value::from(21)).await.unwrap(); assert_eq!(res, val); } }