mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
add dev dependencies for testing wal_checkpoint
This commit is contained in:
parent
66d6291f32
commit
6243ffbab4
3 changed files with 38 additions and 55 deletions
19
Cargo.lock
generated
19
Cargo.lock
generated
|
@ -793,15 +793,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "float-cmp"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fragile"
|
||||
version = "2.0.0"
|
||||
|
@ -1245,7 +1236,6 @@ dependencies = [
|
|||
"env_logger 0.10.2",
|
||||
"limbo_core",
|
||||
"miette",
|
||||
"predicates",
|
||||
"rexpect",
|
||||
"rustyline",
|
||||
]
|
||||
|
@ -1569,12 +1559,6 @@ dependencies = [
|
|||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "normalize-line-endings"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
|
||||
|
||||
[[package]]
|
||||
name = "num-format"
|
||||
version = "0.4.4"
|
||||
|
@ -1850,10 +1834,7 @@ checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573"
|
|||
dependencies = [
|
||||
"anstyle",
|
||||
"difflib",
|
||||
"float-cmp",
|
||||
"normalize-line-endings",
|
||||
"predicates-core",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -33,10 +33,7 @@ miette = { version = "7.4.0", features = ["fancy"] }
|
|||
[features]
|
||||
io_uring = ["limbo_core/io_uring"]
|
||||
|
||||
[dev-dependencies]
|
||||
# not testing the cli on windows as rexpect does not support it.
|
||||
[target.'cfg(not(windows))'.dev-dependencies]
|
||||
assert_cmd = "^2"
|
||||
predicates = "^3"
|
||||
|
||||
# rexpect does not support windows https://github.com/rust-cli/rexpect/issues/11
|
||||
#[target.'cfg(not(windows))'.dev-dependencies]
|
||||
rexpect = "0.6.0"
|
||||
|
|
|
@ -1,35 +1,40 @@
|
|||
use assert_cmd::cargo::cargo_bin;
|
||||
use rexpect::error::*;
|
||||
use rexpect::session::spawn_command;
|
||||
use std::process;
|
||||
/// rexpect does not work on Windows.
|
||||
/// https://github.com/rust-cli/rexpect/issues/11
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
mod tests {
|
||||
use assert_cmd::cargo::cargo_bin;
|
||||
use rexpect::error::*;
|
||||
use rexpect::session::spawn_command;
|
||||
use std::process;
|
||||
|
||||
#[test]
|
||||
fn test_pragma_journal_mode_wal() -> Result<(), Error> {
|
||||
let mut child = spawn_command(run_cli(), Some(1000))?;
|
||||
child.exp_regex("limbo>")?; // skip everything until limbo cursor appear
|
||||
child.exp_regex(".?")?;
|
||||
child.send_line("pragma journal_mode;")?;
|
||||
child.exp_string("wal")?;
|
||||
child.send_line(".quit")?;
|
||||
child.exp_eof()?;
|
||||
Ok(())
|
||||
}
|
||||
#[test]
|
||||
fn test_pragma_journal_mode_wal() -> Result<(), Error> {
|
||||
let mut child = spawn_command(run_cli(), Some(1000))?;
|
||||
child.exp_regex("limbo>")?; // skip everything until limbo cursor appear
|
||||
child.exp_regex(".?")?;
|
||||
child.send_line("pragma journal_mode;")?;
|
||||
child.exp_string("wal")?;
|
||||
child.send_line(".quit")?;
|
||||
child.exp_eof()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[ignore = "wal checkpoint not yet implemented"]
|
||||
#[test]
|
||||
fn test_pragma_wal_checkpoint() -> Result<(), Error> {
|
||||
let mut child = spawn_command(run_cli(), Some(1000))?;
|
||||
child.exp_regex("limbo>")?; // skip everything until limbo cursor appear
|
||||
child.exp_regex(".?")?;
|
||||
child.send_line("pragma wal_checkpoint;")?;
|
||||
child.exp_string("0|0|0")?;
|
||||
child.send_line(".quit")?;
|
||||
child.exp_eof()?;
|
||||
Ok(())
|
||||
}
|
||||
#[ignore = "wal checkpoint not yet implemented"]
|
||||
#[test]
|
||||
fn test_pragma_wal_checkpoint() -> Result<(), Error> {
|
||||
let mut child = spawn_command(run_cli(), Some(1000))?;
|
||||
child.exp_regex("limbo>")?; // skip everything until limbo cursor appear
|
||||
child.exp_regex(".?")?;
|
||||
child.send_line("pragma wal_checkpoint;")?;
|
||||
child.exp_string("0|0|0")?;
|
||||
child.send_line(".quit")?;
|
||||
child.exp_eof()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_cli() -> process::Command {
|
||||
let bin_path = cargo_bin("limbo");
|
||||
let mut cmd = process::Command::new(bin_path);
|
||||
cmd
|
||||
fn run_cli() -> process::Command {
|
||||
let bin_path = cargo_bin("limbo");
|
||||
let mut cmd = process::Command::new(bin_path);
|
||||
cmd
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue