SQLite overhaul: custom value, query db command (#5247)

Clean up query errors
This commit is contained in:
Reilly Wood
2022-04-19 21:58:21 -07:00
committed by GitHub
parent c0ce1e9057
commit b501db673a
13 changed files with 519 additions and 207 deletions

View File

@ -0,0 +1,47 @@
use nu_test_support::{nu, pipeline};
#[test]
fn can_query_single_table() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
open sample.db
| query db "select * from strings"
| where x =~ ell
| length
"#
));
assert_eq!(actual.out, "4");
}
#[test]
fn invalid_sql_fails() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
open sample.db
| query db "select *asdfasdf"
"#
));
assert!(actual.err.contains("syntax error"));
}
#[test]
fn invalid_input_fails() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
"foo" | query db "select * from asdf"
"#
));
assert!(actual.err.contains("pipeline_mismatch"));
}
#[test]
fn scratch() {
assert!(true);
}

View File

@ -0,0 +1 @@
mod db;