mirror of
https://github.com/nushell/nushell.git
synced 2025-08-11 09:54:32 +02:00
Fully qualify the sqlite path for into sqlite
(#16349)
- related #16258 # Description In #16258 we had some trouble getting tests to work properly. After some investigation with @WindSoilder we figured out that `Table::new` inside `into_sqlite.rs` did not respect the `$env.PWD`. The underlying `open_sqlite_db` and in that `Connection::open` respects the current working directory. That one is updated via `cd` but not necessarily in tests (and we should not try that). In this PR I join the `$env.PWD` with the path passed to `into sqlite`. This PR also adds a test for the auto conversion from #16258. # User-Facing Changes Should be none, some edge cases might be fixed now.
This commit is contained in:
@ -495,3 +495,16 @@ fn insert_test_rows(dirs: &Dirs, nu_table: &str, sql_query: Option<&str>, expect
|
||||
|
||||
assert_eq!(expected, actual_rows);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_auto_conversion() {
|
||||
Playground::setup("sqlite json auto conversion", |_, playground| {
|
||||
let raw = "{a_record:{foo:bar,baz:quux},a_list:[1,2,3],a_table:[[a,b];[0,1],[2,3]]}";
|
||||
nu!(cwd: playground.cwd(), "{} | into sqlite filename.db -t my_table", raw);
|
||||
let outcome = nu!(
|
||||
cwd: playground.cwd(),
|
||||
"open filename.db | get my_table.0 | to nuon --raw"
|
||||
);
|
||||
assert_eq!(outcome.out, raw);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user