Skip to content

Commit 777e6d3

Browse files
committed
test: move async_stream_of_rows_from_other_thread up, since it is not a
learning test
1 parent cf3c756 commit 777e6d3

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

odbc-api/tests/integration.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5924,6 +5924,39 @@ fn get_row_array_size_from_statement(profile: &Profile) {
59245924
assert_eq!(10, row_array_size);
59255925
}
59265926

5927+
#[test_case(MSSQL; "Microsoft SQL Server")]
5928+
#[test_case(MARIADB; "Maria DB")]
5929+
#[test_case(SQLITE_3; "SQLite 3")]
5930+
#[test_case(POSTGRES; "PostgreSQL")]
5931+
#[tokio::test]
5932+
async fn async_stream_of_rows_from_other_thread(profile: &Profile) {
5933+
let table_name = table_name!();
5934+
let (conn, table) = Given::new(&table_name)
5935+
.column_types(&["INT"])
5936+
.values_by_column(&[&[Some("42")]])
5937+
.build(profile)
5938+
.unwrap();
5939+
5940+
// When
5941+
fn stream_of_send_rows(
5942+
connection: Connection<'static>,
5943+
query: String,
5944+
) -> impl Stream<Item = (i32,)> + Send + 'static {
5945+
let stmt = connection.into_preallocated().unwrap();
5946+
let mut stmt = stmt.into_polling().unwrap();
5947+
stream! {
5948+
let sleep = || tokio::time::sleep(Duration::from_millis(10));
5949+
let _ = stmt.execute(&query, (), sleep).await;
5950+
yield (42, )
5951+
}
5952+
}
5953+
5954+
// Then
5955+
let stream = stream_of_send_rows(conn, table.sql_all_ordered_by_id());
5956+
let rows = stream.collect::<Vec<_>>().await;
5957+
assert_eq!([(42i32,)].as_slice(), rows)
5958+
}
5959+
59275960
// Learning tests ----------------------------------------------------------------------------------
59285961

59295962
#[test_case(MSSQL; "Microsoft SQL Server")]
@@ -6065,39 +6098,6 @@ fn fetch_decimal_as_numeric_struct_using_bind_col(profile: &Profile) {
60656098
assert_eq!(0, target.val[2]);
60666099
}
60676100

6068-
#[test_case(MSSQL; "Microsoft SQL Server")]
6069-
#[test_case(MARIADB; "Maria DB")]
6070-
#[test_case(SQLITE_3; "SQLite 3")]
6071-
#[test_case(POSTGRES; "PostgreSQL")]
6072-
#[tokio::test]
6073-
async fn async_stream_of_rows_from_other_thread(profile: &Profile) {
6074-
let table_name = table_name!();
6075-
let (conn, table) = Given::new(&table_name)
6076-
.column_types(&["INT"])
6077-
.values_by_column(&[&[Some("42")]])
6078-
.build(profile)
6079-
.unwrap();
6080-
6081-
// When
6082-
fn stream_of_send_rows(
6083-
connection: Connection<'static>,
6084-
query: String,
6085-
) -> impl Stream<Item = (i32,)> + Send + 'static {
6086-
let stmt = connection.into_preallocated().unwrap();
6087-
let mut stmt = stmt.into_polling().unwrap();
6088-
stream! {
6089-
let sleep = || tokio::time::sleep(Duration::from_millis(10));
6090-
let _ = stmt.execute(&query, (), sleep).await;
6091-
yield (42, )
6092-
}
6093-
}
6094-
6095-
// Then
6096-
let stream = stream_of_send_rows(conn, table.sql_all_ordered_by_id());
6097-
let rows = stream.collect::<Vec<_>>().await;
6098-
assert_eq!([(42i32,)].as_slice(), rows)
6099-
}
6100-
61016101
/// Learning test to see how scrolling cursors behave
61026102
#[test_case(MSSQL; "Microsoft SQL Server")]
61036103
#[test_case(MARIADB; "Maria DB")]

0 commit comments

Comments
 (0)