Database commands (#5307)

* database commands

* db commands

* filesystem opens sqlite file

* clippy error

* corrected error in ci file

* removes matrix flag from ci

* flax matrix for clippy

* add conditional compile for tests

* add conditional compile for tests

* correct order of command

* correct error msg

* correct typo
This commit is contained in:
Fernando Herrera
2022-04-24 10:29:21 +01:00
committed by GitHub
parent c20ba95885
commit e94d13da1b
25 changed files with 845 additions and 223 deletions

View File

@ -1,13 +1,12 @@
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"
| db query "select * from strings"
| where x =~ ell
| length
"#
@ -22,7 +21,7 @@ fn invalid_sql_fails() {
cwd: "tests/fixtures/formats", pipeline(
r#"
open sample.db
| query db "select *asdfasdf"
| db query "select *asdfasdf"
"#
));
@ -32,11 +31,11 @@ fn invalid_sql_fails() {
#[test]
fn invalid_input_fails() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
cwd: "tests/fixtures/formats", pipeline(
r#"
"foo" | query db "select * from asdf"
"foo" | db query "select * from asdf"
"#
));
assert!(actual.err.contains("pipeline_mismatch"));
assert!(actual.err.contains("can't convert string"));
}