simplify test a bit

This commit is contained in:
Steven Fackler 2018-06-20 21:08:08 -04:00
parent e86091a268
commit 24d216cd7f

View File

@ -46,10 +46,14 @@ fn insert_select() {
let connection = connection.map_err(|e| panic!("{}", e)); let connection = connection.map_err(|e| panic!("{}", e));
runtime.handle().spawn(connection).unwrap(); runtime.handle().spawn(connection).unwrap();
let create = client.prepare("CREATE TEMPORARY TABLE foo (id SERIAL, name TEXT)"); runtime
let create = runtime.block_on(create).unwrap(); .block_on(
let create = client.execute(&create, &[]).map(|n| assert_eq!(n, 0)); client
runtime.block_on(create).unwrap(); .prepare("CREATE TEMPORARY TABLE foo (id SERIAL, name TEXT)")
.and_then(|create| client.execute(&create, &[]))
.map(|n| assert_eq!(n, 0)),
)
.unwrap();
let insert = client.prepare("INSERT INTO foo (name) VALUES ($1), ($2)"); let insert = client.prepare("INSERT INTO foo (name) VALUES ($1), ($2)");
let select = client.prepare("SELECT id, name FROM foo ORDER BY id"); let select = client.prepare("SELECT id, name FROM foo ORDER BY id");