From 31d2d6945bddf2bf073d1fecb846fa95c15ba23f Mon Sep 17 00:00:00 2001 From: Igor Tonkopryadchenko Date: Mon, 3 Oct 2022 13:18:35 +0300 Subject: [PATCH] switched from unit tests to 'just' binary tests, updated 'rust-apt' dependency to 'main' branch --- .justfile | 12 ++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- src/list.rs | 4 ++++ src/search.rs | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .justfile diff --git a/.justfile b/.justfile new file mode 100644 index 0000000..46a8bce --- /dev/null +++ b/.justfile @@ -0,0 +1,12 @@ +build: + cargo build + +test-root: + just build + + sudo chown root target/debug/mist + sudo chmod a+s target/debug/mist + + if ./target/debug/mist search nonexistent; then echo "Missing 'search' results should not exit with status code 0" && exit 1; fi + + if ./target/debug/mist list nonexistent; then echo "Missing 'list' resulsts should not exit with status code 0" && exit 1; fi \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 36566f3..90e53f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1173,7 +1173,7 @@ dependencies = [ [[package]] name = "rust-apt" version = "0.4.1" -source = "git+https://gitlab.com/volian/rust-apt?branch=fix/tagfile-parsing#7750594be3ca30ee29804bf46cf76896dd61655b" +source = "git+https://gitlab.com/volian/rust-apt#8dd5061314ff7fa699a3b0c3d0658a8d66004603" dependencies = [ "cxx", "cxx-build", diff --git a/Cargo.toml b/Cargo.toml index 6e6bce0..5c176ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ makedeb-srcinfo = "0.8.0" quit = "1.1.4" regex = "1.6.0" reqwest = { version = "0.11.11", features = ["blocking", "json"] } -rust-apt = { git = "https://gitlab.com/volian/rust-apt", branch = "fix/tagfile-parsing" } +rust-apt = { git = "https://gitlab.com/volian/rust-apt" } serde = { version = "1.0.142", features = ["derive"] } serde_json = "1.0.83" tempfile = "3.3.0" diff --git a/src/list.rs b/src/list.rs index 2984018..870d6fb 100644 --- a/src/list.rs +++ b/src/list.rs @@ -29,6 +29,10 @@ pub fn list(args: &clap::ArgMatches) { } } + if candidates.is_empty() { + quit::with_code(exitcode::UNAVAILABLE); + } + print!( "{}", style::generate_pkginfo_entries( diff --git a/src/search.rs b/src/search.rs index cfb7297..82b5254 100644 --- a/src/search.rs +++ b/src/search.rs @@ -42,6 +42,10 @@ pub fn search(args: &clap::ArgMatches) { } } + if candidates.is_empty() { + quit::with_code(exitcode::UNAVAILABLE); + } + print!( "{}", style::generate_pkginfo_entries(