Fix tests, replace match with matches!
This commit is contained in:
parent
d9d283e131
commit
6fae6552ec
@ -96,4 +96,5 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
|||||||
CREATE ROLE ssl_user LOGIN;
|
CREATE ROLE ssl_user LOGIN;
|
||||||
CREATE EXTENSION hstore;
|
CREATE EXTENSION hstore;
|
||||||
CREATE EXTENSION citext;
|
CREATE EXTENSION citext;
|
||||||
|
CREATE EXTENSION ltree;
|
||||||
EOSQL
|
EOSQL
|
||||||
|
@ -174,12 +174,7 @@ fn ltree_str() {
|
|||||||
let mut query = vec![1u8];
|
let mut query = vec![1u8];
|
||||||
query.extend_from_slice("A.B.C".as_bytes());
|
query.extend_from_slice("A.B.C".as_bytes());
|
||||||
|
|
||||||
let success = match ltree_from_sql(query.as_slice()) {
|
assert!(matches!(ltree_from_sql(query.as_slice()), Ok(_)))
|
||||||
Ok(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(success)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -187,12 +182,7 @@ fn ltree_wrong_version() {
|
|||||||
let mut query = vec![2u8];
|
let mut query = vec![2u8];
|
||||||
query.extend_from_slice("A.B.C".as_bytes());
|
query.extend_from_slice("A.B.C".as_bytes());
|
||||||
|
|
||||||
let success = match ltree_from_sql(query.as_slice()) {
|
assert!(matches!(ltree_from_sql(query.as_slice()), Err(_)))
|
||||||
Err(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(success)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -212,12 +202,7 @@ fn lquery_str() {
|
|||||||
let mut query = vec![1u8];
|
let mut query = vec![1u8];
|
||||||
query.extend_from_slice("A.B.C".as_bytes());
|
query.extend_from_slice("A.B.C".as_bytes());
|
||||||
|
|
||||||
let success = match lquery_from_sql(query.as_slice()) {
|
assert!(matches!(lquery_from_sql(query.as_slice()), Ok(_)))
|
||||||
Ok(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(success)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -225,12 +210,7 @@ fn lquery_wrong_version() {
|
|||||||
let mut query = vec![2u8];
|
let mut query = vec![2u8];
|
||||||
query.extend_from_slice("A.B.C".as_bytes());
|
query.extend_from_slice("A.B.C".as_bytes());
|
||||||
|
|
||||||
let success = match lquery_from_sql(query.as_slice()) {
|
assert!(matches!(lquery_from_sql(query.as_slice()), Err(_)))
|
||||||
Err(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(success)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -250,12 +230,7 @@ fn ltxtquery_str() {
|
|||||||
let mut query = vec![1u8];
|
let mut query = vec![1u8];
|
||||||
query.extend_from_slice("a & b*".as_bytes());
|
query.extend_from_slice("a & b*".as_bytes());
|
||||||
|
|
||||||
let success = match ltree_from_sql(query.as_slice()) {
|
assert!(matches!(ltree_from_sql(query.as_slice()), Ok(_)))
|
||||||
Ok(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(success)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -263,10 +238,5 @@ fn ltxtquery_wrong_version() {
|
|||||||
let mut query = vec![2u8];
|
let mut query = vec![2u8];
|
||||||
query.extend_from_slice("a & b*".as_bytes());
|
query.extend_from_slice("a & b*".as_bytes());
|
||||||
|
|
||||||
let success = match ltree_from_sql(query.as_slice()) {
|
assert!(matches!(ltree_from_sql(query.as_slice()), Err(_)))
|
||||||
Err(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(success)
|
|
||||||
}
|
}
|
||||||
|
@ -651,12 +651,6 @@ async fn inet() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn ltree() {
|
async fn ltree() {
|
||||||
let client = connect("user=postgres").await;
|
|
||||||
client
|
|
||||||
.execute("CREATE EXTENSION IF NOT EXISTS ltree;", &[])
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
test_type(
|
test_type(
|
||||||
"ltree",
|
"ltree",
|
||||||
&[(Some("b.c.d".to_owned()), "'b.c.d'"), (None, "NULL")],
|
&[(Some("b.c.d".to_owned()), "'b.c.d'"), (None, "NULL")],
|
||||||
@ -666,12 +660,6 @@ async fn ltree() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn ltree_any() {
|
async fn ltree_any() {
|
||||||
let client = connect("user=postgres").await;
|
|
||||||
client
|
|
||||||
.execute("CREATE EXTENSION IF NOT EXISTS ltree;", &[])
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
test_type(
|
test_type(
|
||||||
"ltree[]",
|
"ltree[]",
|
||||||
&[
|
&[
|
||||||
@ -689,12 +677,6 @@ async fn ltree_any() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn lquery() {
|
async fn lquery() {
|
||||||
let client = connect("user=postgres").await;
|
|
||||||
client
|
|
||||||
.execute("CREATE EXTENSION IF NOT EXISTS ltree;", &[])
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
test_type(
|
test_type(
|
||||||
"lquery",
|
"lquery",
|
||||||
&[
|
&[
|
||||||
@ -709,12 +691,6 @@ async fn lquery() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn lquery_any() {
|
async fn lquery_any() {
|
||||||
let client = connect("user=postgres").await;
|
|
||||||
client
|
|
||||||
.execute("CREATE EXTENSION IF NOT EXISTS ltree;", &[])
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
test_type(
|
test_type(
|
||||||
"lquery[]",
|
"lquery[]",
|
||||||
&[
|
&[
|
||||||
@ -732,12 +708,6 @@ async fn lquery_any() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn ltxtquery() {
|
async fn ltxtquery() {
|
||||||
let client = connect("user=postgres").await;
|
|
||||||
client
|
|
||||||
.execute("CREATE EXTENSION IF NOT EXISTS ltree;", &[])
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
test_type(
|
test_type(
|
||||||
"ltxtquery",
|
"ltxtquery",
|
||||||
&[
|
&[
|
||||||
@ -751,12 +721,6 @@ async fn ltxtquery() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn ltxtquery_any() {
|
async fn ltxtquery_any() {
|
||||||
let client = connect("user=postgres").await;
|
|
||||||
client
|
|
||||||
.execute("CREATE EXTENSION IF NOT EXISTS ltree;", &[])
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
test_type(
|
test_type(
|
||||||
"ltxtquery[]",
|
"ltxtquery[]",
|
||||||
&[
|
&[
|
||||||
|
Loading…
Reference in New Issue
Block a user