Skip to content

Commit f537a61

Browse files
committed
Add a test for modified row count
1 parent 61de210 commit f537a61

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,19 @@ fn test_result_descriptions() {
223223
ResultDescription { name: ~"b", ty: PgVarchar}]);
224224
}
225225
226+
#[test]
227+
fn test_execute_counts() {
228+
let conn = PostgresConnection::connect("postgres://postgres@localhost", &NoSsl);
229+
assert_eq!(0, conn.execute("CREATE TEMPORARY TABLE foo (
230+
id SERIAL PRIMARY KEY,
231+
b INT
232+
)", []));
233+
assert_eq!(3, conn.execute("INSERT INTO foo (b) VALUES ($1), ($2), ($2)",
234+
[&1i32 as &ToSql, &2i32 as &ToSql]));
235+
assert_eq!(2, conn.execute("UPDATE foo SET b = 0 WHERE b = 2", []));
236+
assert_eq!(3, conn.execute("SELECT * FROM foo", []));
237+
}
238+
226239
fn test_type<T: Eq+FromSql+ToSql, S: Str>(sql_type: &str, checks: &[(T, S)]) {
227240
let conn = PostgresConnection::connect("postgres://postgres@localhost", &NoSsl);
228241
for &(ref val, ref repr) in checks.iter() {

0 commit comments

Comments
 (0)