Skip to content

Commit

Permalink
chore: add tests of Error::InvalidSavePointStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsairobo committed Nov 28, 2024
1 parent 69638a6 commit 92e71f4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/mysql/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,17 @@ async fn it_fails_with_begin_failed() -> anyhow::Result<()> {

Ok(())
}

#[sqlx_macros::test]
async fn it_fails_with_invalid_save_point_statement() -> anyhow::Result<()> {
let mut conn = new::<MySql>().await?;
let mut txn = conn.begin().await?;
let txn_conn = sqlx::Acquire::acquire(&mut txn).await?;
let res = txn_conn.begin_with("BEGIN").await;

let err = res.unwrap_err();

assert!(matches!(err, Error::InvalidSavePointStatement), "{err}");

Ok(())
}
14 changes: 14 additions & 0 deletions tests/postgres/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,17 @@ async fn it_fails_with_begin_failed() -> anyhow::Result<()> {

Ok(())
}

#[sqlx_macros::test]
async fn it_fails_with_invalid_save_point_statement() -> anyhow::Result<()> {
let mut conn = new::<Postgres>().await?;
let mut txn = conn.begin().await?;
let txn_conn = sqlx::Acquire::acquire(&mut txn).await?;
let res = txn_conn.begin_with("BEGIN").await;

let err = res.unwrap_err();

assert!(matches!(err, Error::InvalidSavePointStatement), "{err}");

Ok(())
}
14 changes: 14 additions & 0 deletions tests/sqlite/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,17 @@ async fn it_fails_with_begin_failed() -> anyhow::Result<()> {

Ok(())
}

#[sqlx_macros::test]
async fn it_fails_with_invalid_save_point_statement() -> anyhow::Result<()> {
let mut conn = new::<Sqlite>().await?;
let mut txn = conn.begin().await?;
let txn_conn = sqlx::Acquire::acquire(&mut txn).await?;
let res = txn_conn.begin_with("BEGIN").await;

let err = res.unwrap_err();

assert!(matches!(err, Error::InvalidSavePointStatement), "{err}");

Ok(())
}

0 comments on commit 92e71f4

Please sign in to comment.