mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +00:00
Add a failing test for reading columns with NULLs
This commit is contained in:
parent
fa17cd620e
commit
f8f737bf2f
23
tests/lib.rs
23
tests/lib.rs
@ -72,6 +72,29 @@ fn connection_set_busy_handler() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cursor_read() {
|
||||
let connection = setup_users(":memory:");
|
||||
ok!(connection.execute("INSERT INTO users VALUES (2, 'Bob', NULL, NULL)"));
|
||||
let statement = "SELECT id, age FROM users ORDER BY 1 DESC";
|
||||
let statement = ok!(connection.prepare(statement));
|
||||
|
||||
let mut count = 0;
|
||||
let mut cursor = statement.cursor();
|
||||
while let Some(row) = ok!(cursor.next()) {
|
||||
let id = row[0].as_integer().unwrap();
|
||||
if id == 1 {
|
||||
assert_eq!(row[1].as_float().unwrap(), 42.69);
|
||||
} else if id == 2 {
|
||||
assert_eq!(row[1].as_float().unwrap_or(69.42), 69.42);
|
||||
} else {
|
||||
assert!(false);
|
||||
}
|
||||
count += 1;
|
||||
}
|
||||
assert_eq!(count, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cursor_wildcard_with_binding() {
|
||||
let connection = setup_english(":memory:");
|
||||
|
Loading…
x
Reference in New Issue
Block a user