2020-07-18 03:59:23 +02:00
|
|
|
#[cfg(feature = "sqlite")]
|
2019-12-17 19:54:39 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
2019-12-15 17:15:06 +01:00
|
|
|
|
2020-07-18 03:59:23 +02:00
|
|
|
#[cfg(feature = "sqlite")]
|
2019-12-15 17:15:06 +01:00
|
|
|
#[test]
|
|
|
|
fn table_to_sqlite_and_back_into_table() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open sample.db
|
2020-05-04 10:44:33 +02:00
|
|
|
| to sqlite
|
|
|
|
| from sqlite
|
2019-12-15 17:15:06 +01:00
|
|
|
| get table_values
|
2022-02-09 15:59:40 +01:00
|
|
|
| select 2
|
2019-12-15 17:15:06 +01:00
|
|
|
| get x
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "hello");
|
2019-12-15 17:15:06 +01:00
|
|
|
}
|
2021-06-10 14:41:43 +02:00
|
|
|
|
|
|
|
#[cfg(feature = "sqlite")]
|
|
|
|
#[test]
|
|
|
|
fn table_to_sqlite_and_back_into_table_select_table() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open sample.db
|
|
|
|
| to sqlite
|
|
|
|
| from sqlite -t [strings]
|
|
|
|
| get table_names
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "strings");
|
|
|
|
}
|