diff --git a/src/macros/test.md b/src/macros/test.md index 13c241524e..720fe51c91 100644 --- a/src/macros/test.md +++ b/src/macros/test.md @@ -64,17 +64,17 @@ To limit disk space usage, any previously created test databases will be deleted ```rust,no_run # #[cfg(all(feature = "migrate", feature = "postgres"))] # mod example { -use sqlx::PgPool; +use sqlx::{PgPool, Row}; #[sqlx::test] async fn basic_test(pool: PgPool) -> sqlx::Result<()> { let mut conn = pool.acquire().await?; - sqlx::query("SELECT * FROM foo") + let foo = sqlx::query("SELECT * FROM foo") .fetch_one(&mut conn) .await?; - - assert_eq!(foo.get::("bar"), "foobar!"); + + assert_eq!(foo.get::("bar"), "foobar!"); Ok(()) } @@ -96,17 +96,17 @@ supported): ```rust,ignore # #[cfg(all(feature = "migrate", feature = "postgres"))] # mod example { -use sqlx::PgPool; +use sqlx::{PgPool, Row}; #[sqlx::test(migrations = "foo_migrations")] async fn basic_test(pool: PgPool) -> sqlx::Result<()> { let mut conn = pool.acquire().await?; - sqlx::query("SELECT * FROM foo") + let foo = sqlx::query("SELECT * FROM foo") .fetch_one(&mut conn) .await?; - - assert_eq!(foo.get::("bar"), "foobar!"); + + assert_eq!(foo.get::("bar"), "foobar!"); Ok(()) } @@ -124,7 +124,7 @@ pub static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!("foo_migrations"); ```rust,no_run # #[cfg(all(feature = "migrate", feature = "postgres"))] # mod example { -use sqlx::PgPool; +use sqlx::{PgPool, Row}; # // This is standing in for the main crate since doc examples don't support multiple crates. # mod foo_crate { @@ -141,11 +141,11 @@ use sqlx::PgPool; async fn basic_test(pool: PgPool) -> sqlx::Result<()> { let mut conn = pool.acquire().await?; - sqlx::query("SELECT * FROM foo") + let foo = sqlx::query("SELECT * FROM foo") .fetch_one(&mut conn) .await?; - - assert_eq!(foo.get::("bar"), "foobar!"); + + assert_eq!(foo.get::("bar"), "foobar!"); Ok(()) } @@ -157,7 +157,7 @@ Or disable migrations processing entirely: ```rust,no_run # #[cfg(all(feature = "migrate", feature = "postgres"))] # mod example { -use sqlx::PgPool; +use sqlx::{PgPool, Row}; #[sqlx::test(migrations = false)] async fn basic_test(pool: PgPool) -> sqlx::Result<()> { @@ -165,11 +165,11 @@ async fn basic_test(pool: PgPool) -> sqlx::Result<()> { conn.execute("CREATE TABLE foo(bar text)").await?; - sqlx::query("SELECT * FROM foo") + let foo = sqlx::query("SELECT * FROM foo") .fetch_one(&mut conn) .await?; - - assert_eq!(foo.get::("bar"), "foobar!"); + + assert_eq!(foo.get::("bar"), "foobar!"); Ok(()) }