mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
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:
@ -39,6 +39,7 @@ mod open;
|
||||
mod parse;
|
||||
mod path;
|
||||
mod prepend;
|
||||
#[cfg(feature = "database")]
|
||||
mod query;
|
||||
mod random;
|
||||
mod range;
|
||||
|
@ -108,8 +108,8 @@ fn parses_more_bson_complexity() {
|
||||
// │ 4 │ │
|
||||
// ╰───┴──────╯
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
#[test]
|
||||
|
||||
fn parses_sqlite() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
@ -123,6 +123,7 @@ fn parses_sqlite() {
|
||||
assert_eq!(actual.out, "3");
|
||||
}
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
#[test]
|
||||
fn parses_sqlite_get_column_name() {
|
||||
let actual = nu!(
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ fn where_not_in_table() {
|
||||
assert_eq!(actual.out, "4");
|
||||
}
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
#[test]
|
||||
fn binary_operator_comparisons() {
|
||||
let actual = nu!(
|
||||
@ -109,6 +110,7 @@ fn binary_operator_comparisons() {
|
||||
assert_eq!(actual.out, "42");
|
||||
}
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
#[test]
|
||||
fn contains_operator() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user