mirror of
https://github.com/nushell/nushell.git
synced 2024-12-04 22:33:50 +01:00
efdfeac55e
Following up on #7180 with some feature cleanup: - Move the `database` feature from `plugin` to `default` - Rename the `database` feature to `sqlite` - Remove `--features=extra` from a lot of scripts etc. - No need to specify this, the `extra` feature is now the same as the default feature set - Remove the now-redundant 2nd Ubuntu test run
45 lines
922 B
Rust
45 lines
922 B
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[cfg(feature = "sqlite")]
|
|
#[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");
|
|
}
|
|
|
|
#[cfg(feature = "sqlite")]
|
|
#[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"));
|
|
}
|
|
|
|
#[cfg(feature = "sqlite")]
|
|
#[test]
|
|
fn invalid_input_fails() {
|
|
let actual = nu!(
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
r#"
|
|
"foo" | query db "select * from asdf"
|
|
"#
|
|
));
|
|
|
|
assert!(actual.err.contains("can't convert string"));
|
|
}
|