From 1c79ebff3378e1384a6c2c01a0576ec56cd3dcbe Mon Sep 17 00:00:00 2001 From: fox0 <15684995+fox0@users.noreply.github.com> Date: Sat, 26 Oct 2024 20:15:53 +0700 Subject: [PATCH 1/2] Rename plib-testing --- Cargo.lock | 30 +++++++++++++------ Cargo.toml | 5 +++- awk/Cargo.toml | 2 +- awk/tests/integration.rs | 2 +- calc/Cargo.toml | 2 +- calc/tests/bc/mod.rs | 2 +- calc/tests/expr/mod.rs | 2 +- datetime/Cargo.toml | 2 +- datetime/tests/time/mod.rs | 2 +- dev/Cargo.toml | 2 +- dev/tests/dev-tests.rs | 5 ++-- display/Cargo.toml | 2 +- display/tests/echo/mod.rs | 2 +- display/tests/printf/mod.rs | 2 +- file/Cargo.toml | 5 +++- file/tests/cmp/mod.rs | 2 +- file/tests/dd/mod.rs | 2 +- file/tests/file/mod.rs | 2 +- file/tests/find/mod.rs | 2 +- file/tests/od/mod.rs | 2 +- i18n/Cargo.toml | 5 +++- i18n/tests/gencat/mod.rs | 3 +- i18n/tests/iconv/mod.rs | 4 ++- make/Cargo.toml | 2 +- make/tests/integration.rs | 2 +- misc/Cargo.toml | 2 +- misc/tests/false/mod.rs | 2 +- misc/tests/test/mod.rs | 2 +- misc/tests/true/mod.rs | 2 +- pathnames/Cargo.toml | 2 +- pathnames/tests/basename/mod.rs | 2 +- pathnames/tests/dirname/mod.rs | 2 +- pathnames/tests/realpath/mod.rs | 2 +- plib-testing/Cargo.toml | 16 ++++++++++ .../src/testing.rs => plib-testing/src/lib.rs | 0 plib/src/lib.rs | 1 - process/Cargo.toml | 9 +++--- process/tests/fuser/mod.rs | 2 +- process/tests/xargs/mod.rs | 2 +- sccs/Cargo.toml | 2 +- sccs/tests/what/mod.rs | 2 +- sys/Cargo.toml | 5 +++- sys/tests/getconf/mod.rs | 2 +- text/Cargo.toml | 3 +- text/tests/comm/mod.rs | 2 +- text/tests/csplit/mod.rs | 2 +- text/tests/cut/mod.rs | 2 +- text/tests/diff-tests.rs | 2 +- text/tests/expand/mod.rs | 2 +- text/tests/fold/mod.rs | 2 +- text/tests/grep/mod.rs | 2 +- text/tests/head/mod.rs | 4 +-- text/tests/join/mod.rs | 2 +- text/tests/nl/mod.rs | 2 +- text/tests/paste/mod.rs | 2 +- text/tests/pr/mod.rs | 2 +- text/tests/sort/mod.rs | 2 +- text/tests/tail/mod.rs | 2 +- text/tests/tr/mod.rs | 2 +- text/tests/unexpand/mod.rs | 2 +- text/tests/uniq/mod.rs | 2 +- text/tests/wc/mod.rs | 2 +- tree/Cargo.toml | 5 ++-- tree/tests/cp/mod.rs | 2 +- tree/tests/integration2.rs | 2 +- tree/tests/link/mod.rs | 2 +- tree/tests/ls/mod.rs | 2 +- tree/tests/mkdir/mod.rs | 2 +- tree/tests/mv/mod.rs | 2 +- tree/tests/readlink/mod.rs | 2 +- tree/tests/rm/mod.rs | 2 +- tree/tests/rmdir/mod.rs | 2 +- tree/tests/unlink/mod.rs | 2 +- users/Cargo.toml | 6 ++-- xform/Cargo.toml | 5 +++- xform/tests/cksum/mod.rs | 2 +- xform/tests/compress/mod.rs | 2 +- xform/tests/uue/mod.rs | 2 +- 78 files changed, 142 insertions(+), 91 deletions(-) create mode 100644 plib-testing/Cargo.toml rename plib/src/testing.rs => plib-testing/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index e7b4889e..422859aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1297,6 +1297,10 @@ dependencies = [ "libc", ] +[[package]] +name = "plib-testing" +version = "0.2.1" + [[package]] name = "posixutils-awk" version = "0.2.1" @@ -1308,7 +1312,7 @@ dependencies = [ "libc", "pest", "pest_derive", - "plib", + "plib-testing", "rand", ] @@ -1322,7 +1326,7 @@ dependencies = [ "lazy_static", "pest", "pest_derive", - "plib", + "plib-testing", "regex", "rustyline", ] @@ -1335,7 +1339,7 @@ dependencies = [ "clap", "gettext-rs", "libc", - "plib", + "plib-testing", ] [[package]] @@ -1347,7 +1351,7 @@ dependencies = [ "clap", "gettext-rs", "object", - "plib", + "plib-testing", ] [[package]] @@ -1356,7 +1360,7 @@ version = "0.2.1" dependencies = [ "clap", "gettext-rs", - "plib", + "plib-testing", ] [[package]] @@ -1367,6 +1371,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "regex", "users", "walkdir", @@ -1390,6 +1395,7 @@ dependencies = [ "clap", "gettext-rs", "plib", + "plib-testing", "strum", "strum_macros", ] @@ -1420,7 +1426,7 @@ dependencies = [ "const_format", "gettext-rs", "libc", - "plib", + "plib-testing", "rowan", ] @@ -1431,7 +1437,7 @@ dependencies = [ "clap", "gettext-rs", "libc", - "plib", + "plib-testing", ] [[package]] @@ -1441,7 +1447,7 @@ dependencies = [ "clap", "gettext-rs", "libc", - "plib", + "plib-testing", ] [[package]] @@ -1454,6 +1460,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "sysinfo", ] @@ -1463,7 +1470,7 @@ version = "0.2.1" dependencies = [ "clap", "gettext-rs", - "plib", + "plib-testing", ] [[package]] @@ -1486,6 +1493,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "uname", ] @@ -1501,6 +1509,7 @@ dependencies = [ "libc", "notify-debouncer-full", "plib", + "plib-testing", "proptest", "rand", "regex", @@ -1519,6 +1528,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "regex", "tempfile", ] @@ -1534,6 +1544,7 @@ dependencies = [ "libc", "libcrypt-rs", "plib", + "plib-testing", "syslog", "thiserror", ] @@ -1547,6 +1558,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d0140c1c..e5cb5533 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ members = [ "misc", "pathnames", "plib", + "plib-testing", "process", "sccs", "screen", @@ -41,6 +42,8 @@ libc = "0.2" regex = "1.10" gettext-rs = { path = "./gettext-rs" } errno = "0.3" +plib = { path = "./plib" } +plib-testing = { path = "./plib-testing" } +ftw = { path = "./ftw" } [workspace.lints] - diff --git a/awk/Cargo.toml b/awk/Cargo.toml index 7a204133..6be3993b 100644 --- a/awk/Cargo.toml +++ b/awk/Cargo.toml @@ -17,7 +17,7 @@ lexical = { version = "6.1", features = ["format"] } rand = {version = "0.8", default-features = false, features = ["small_rng"] } [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/awk/tests/integration.rs b/awk/tests/integration.rs index 831356c8..0940017a 100644 --- a/awk/tests/integration.rs +++ b/awk/tests/integration.rs @@ -1,4 +1,4 @@ -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; fn test_awk(args: Vec, expected_output: &str) { run_test(TestPlan { diff --git a/calc/Cargo.toml b/calc/Cargo.toml index a568378d..0dc69570 100644 --- a/calc/Cargo.toml +++ b/calc/Cargo.toml @@ -17,7 +17,7 @@ bigdecimal = "0.4" rustyline = { version = "14.0", default-features = false } [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/calc/tests/bc/mod.rs b/calc/tests/bc/mod.rs index b9bf58af..2681da41 100644 --- a/calc/tests/bc/mod.rs +++ b/calc/tests/bc/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn test_bc(program: &str, expected_output: &str) { run_test(TestPlan { diff --git a/calc/tests/expr/mod.rs b/calc/tests/expr/mod.rs index 8cb428c2..b38f4e33 100644 --- a/calc/tests/expr/mod.rs +++ b/calc/tests/expr/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn expr_test(args: &[&str], expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/datetime/Cargo.toml b/datetime/Cargo.toml index 601b5ba9..a27c71f2 100644 --- a/datetime/Cargo.toml +++ b/datetime/Cargo.toml @@ -14,7 +14,7 @@ chrono.workspace = true libc.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/datetime/tests/time/mod.rs b/datetime/tests/time/mod.rs index 7d4b0e4b..86944a49 100644 --- a/datetime/tests/time/mod.rs +++ b/datetime/tests/time/mod.rs @@ -12,7 +12,7 @@ use std::{ process::{Command, Output, Stdio}, }; -use plib::testing::TestPlan; +use plib_testing::TestPlan; fn run_test_base(cmd: &str, args: &Vec, stdin_data: &[u8]) -> Output { let relpath = if cfg!(debug_assertions) { diff --git a/dev/Cargo.toml b/dev/Cargo.toml index faebcd67..d40d5150 100644 --- a/dev/Cargo.toml +++ b/dev/Cargo.toml @@ -15,7 +15,7 @@ chrono.workspace = true ar = "0.9" [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/dev/tests/dev-tests.rs b/dev/tests/dev-tests.rs index 835d3f30..dd4ef2b0 100644 --- a/dev/tests/dev-tests.rs +++ b/dev/tests/dev-tests.rs @@ -1,7 +1,8 @@ -use object::{Object, ObjectSection, ObjectSymbol}; -use plib::testing::{run_test, run_test_with_checker, TestPlan}; use std::fs; +use object::{Object, ObjectSection, ObjectSymbol}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; + fn ar_compare_test( args: &[&str], stdout: &str, diff --git a/display/Cargo.toml b/display/Cargo.toml index cd1dce75..21e92240 100644 --- a/display/Cargo.toml +++ b/display/Cargo.toml @@ -12,7 +12,7 @@ clap.workspace = true gettext-rs.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/display/tests/echo/mod.rs b/display/tests/echo/mod.rs index 2a75891f..16409934 100644 --- a/display/tests/echo/mod.rs +++ b/display/tests/echo/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn echo_test(args: &[&str], expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/display/tests/printf/mod.rs b/display/tests/printf/mod.rs index f04cc960..4d69bd45 100644 --- a/display/tests/printf/mod.rs +++ b/display/tests/printf/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; #[test] fn test_basic_string_output() { diff --git a/file/Cargo.toml b/file/Cargo.toml index 93a90f8a..1c4b708b 100644 --- a/file/Cargo.toml +++ b/file/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true @@ -16,6 +16,9 @@ regex.workspace = true walkdir = "2" users = "0.11" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/file/tests/cmp/mod.rs b/file/tests/cmp/mod.rs index badee5a3..af354d96 100644 --- a/file/tests/cmp/mod.rs +++ b/file/tests/cmp/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn run_test_helper( args: &[&str], diff --git a/file/tests/dd/mod.rs b/file/tests/dd/mod.rs index ff801e0c..aa4f33a1 100644 --- a/file/tests/dd/mod.rs +++ b/file/tests/dd/mod.rs @@ -2,7 +2,7 @@ use std::fs::File; use std::io::Read; use std::path::PathBuf; -use plib::testing::{run_test_u8, TestPlanU8}; +use plib_testing::{run_test_u8, TestPlanU8}; fn get_test_file_path(filename: &str) -> PathBuf { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); diff --git a/file/tests/file/mod.rs b/file/tests/file/mod.rs index 5a9f7ba7..f276f643 100644 --- a/file/tests/file/mod.rs +++ b/file/tests/file/mod.rs @@ -9,7 +9,7 @@ use std::{env, path::PathBuf}; -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn file_test(args: &[&str], expected_output: &str, expected_error: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/file/tests/find/mod.rs b/file/tests/find/mod.rs index 6d413860..96b365aa 100644 --- a/file/tests/find/mod.rs +++ b/file/tests/find/mod.rs @@ -1,7 +1,7 @@ use std::fs::{remove_file, File}; use std::io::Write; -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn run_test_find( args: &[&str], diff --git a/file/tests/od/mod.rs b/file/tests/od/mod.rs index cdfdf689..6d7fd0cd 100644 --- a/file/tests/od/mod.rs +++ b/file/tests/od/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn od_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/i18n/Cargo.toml b/i18n/Cargo.toml index fdedb491..2dde17db 100644 --- a/i18n/Cargo.toml +++ b/i18n/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true bytemuck = { version = "1.17", features = ["derive"] } @@ -16,6 +16,9 @@ byteorder = "1.5" strum = "0.26" strum_macros = "0.26" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/i18n/tests/gencat/mod.rs b/i18n/tests/gencat/mod.rs index 5c4fbf0a..d3db00db 100644 --- a/i18n/tests/gencat/mod.rs +++ b/i18n/tests/gencat/mod.rs @@ -7,11 +7,12 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_u8, TestPlanU8}; use std::env; use std::path::PathBuf; use std::{fs::File, io::Read}; +use plib_testing::{run_test_u8, TestPlanU8}; + fn gencat_test(args: &[&str], expected_output: Vec, expected_error: Vec) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); run_test_u8(TestPlanU8 { diff --git a/i18n/tests/iconv/mod.rs b/i18n/tests/iconv/mod.rs index 47b63ca7..6c25d078 100644 --- a/i18n/tests/iconv/mod.rs +++ b/i18n/tests/iconv/mod.rs @@ -8,11 +8,13 @@ // #![allow(non_snake_case)] -use plib::testing::{run_test_u8, TestPlanU8}; + use std::env; use std::path::PathBuf; use std::{fs::File, io::Read}; +use plib_testing::{run_test_u8, TestPlanU8}; + fn iconv_test(args: &[&str], input: Vec, expected_output: Vec, expected_error: Vec) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); run_test_u8(TestPlanU8 { diff --git a/make/Cargo.toml b/make/Cargo.toml index a6bacbe7..45ec6430 100644 --- a/make/Cargo.toml +++ b/make/Cargo.toml @@ -14,7 +14,7 @@ const_format = "0.2" rowan = "0.15" [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [[bin]] name = "make" diff --git a/make/tests/integration.rs b/make/tests/integration.rs index 9a583df0..f5b261cf 100644 --- a/make/tests/integration.rs +++ b/make/tests/integration.rs @@ -12,7 +12,7 @@ use std::fs::{remove_file, File}; use std::io::Write; use std::process::{Child, Command, Stdio}; -use plib::testing::{run_test, run_test_base, TestPlan}; +use plib_testing::{run_test, run_test_base, TestPlan}; use posixutils_make::error_code::ErrorCode; diff --git a/misc/Cargo.toml b/misc/Cargo.toml index 5c01e72b..b984b798 100644 --- a/misc/Cargo.toml +++ b/misc/Cargo.toml @@ -13,7 +13,7 @@ libc.workspace = true gettext-rs.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/misc/tests/false/mod.rs b/misc/tests/false/mod.rs index 694ded2f..6495e776 100644 --- a/misc/tests/false/mod.rs +++ b/misc/tests/false/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn truefalse_test(cmd: &str, expected_exit_code: i32) { run_test(TestPlan { diff --git a/misc/tests/test/mod.rs b/misc/tests/test/mod.rs index 3006e1d2..1d229903 100644 --- a/misc/tests/test/mod.rs +++ b/misc/tests/test/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn test_test(args: &[&str], expected_code: i32) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/misc/tests/true/mod.rs b/misc/tests/true/mod.rs index 9d6972bb..92c18eb2 100644 --- a/misc/tests/true/mod.rs +++ b/misc/tests/true/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn truefalse_test(cmd: &str, expected_exit_code: i32) { run_test(TestPlan { diff --git a/pathnames/Cargo.toml b/pathnames/Cargo.toml index 38b7e6f6..5a1aea53 100644 --- a/pathnames/Cargo.toml +++ b/pathnames/Cargo.toml @@ -13,7 +13,7 @@ gettext-rs.workspace = true libc.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/pathnames/tests/basename/mod.rs b/pathnames/tests/basename/mod.rs index 6425fd03..5c96d7f7 100644 --- a/pathnames/tests/basename/mod.rs +++ b/pathnames/tests/basename/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; #[test] fn basename_basic() { diff --git a/pathnames/tests/dirname/mod.rs b/pathnames/tests/dirname/mod.rs index 1722e0af..af58dc8e 100644 --- a/pathnames/tests/dirname/mod.rs +++ b/pathnames/tests/dirname/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; #[test] fn dirname_basic() { diff --git a/pathnames/tests/realpath/mod.rs b/pathnames/tests/realpath/mod.rs index db215c40..c887d299 100644 --- a/pathnames/tests/realpath/mod.rs +++ b/pathnames/tests/realpath/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn realpath_test(args: &[&str], stdout: &str, stderr: &str, expected_code: i32) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/plib-testing/Cargo.toml b/plib-testing/Cargo.toml new file mode 100644 index 00000000..546f5c7a --- /dev/null +++ b/plib-testing/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "plib-testing" +version = "0.2.1" +authors = ["Jeff Garzik"] +repository.workspace = true +license.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] + +[lints] +workspace = true + +[lib] +doctest = false diff --git a/plib/src/testing.rs b/plib-testing/src/lib.rs similarity index 100% rename from plib/src/testing.rs rename to plib-testing/src/lib.rs diff --git a/plib/src/lib.rs b/plib/src/lib.rs index de06edd6..8e710d0b 100644 --- a/plib/src/lib.rs +++ b/plib/src/lib.rs @@ -15,7 +15,6 @@ pub mod modestr; pub mod platform; pub mod priority; pub mod sccsfile; -pub mod testing; pub mod utmpx; pub const BUFSZ: usize = 8 * 1024; diff --git a/process/Cargo.toml b/process/Cargo.toml index 20f7f264..498a4c8d 100644 --- a/process/Cargo.toml +++ b/process/Cargo.toml @@ -8,21 +8,22 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true dirs = "5.0" +[dev-dependencies] +plib-testing.workspace = true +sysinfo = "0.31" + [build-dependencies] bindgen = { version = "0.70.0", features = ["runtime"] } [lints] workspace = true -[dev-dependencies] -sysinfo = "0.31" - [[bin]] name = "fuser" path = "./fuser.rs" diff --git a/process/tests/fuser/mod.rs b/process/tests/fuser/mod.rs index 85b6d82a..f7a62eb9 100644 --- a/process/tests/fuser/mod.rs +++ b/process/tests/fuser/mod.rs @@ -1,4 +1,4 @@ -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::process::Output; mod basic; diff --git a/process/tests/xargs/mod.rs b/process/tests/xargs/mod.rs index 15ad9221..a1d5a519 100644 --- a/process/tests/xargs/mod.rs +++ b/process/tests/xargs/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn xargs_test(test_data: &str, expected_output: &str, args: Vec<&str>) { run_test(TestPlan { diff --git a/sccs/Cargo.toml b/sccs/Cargo.toml index 113a3601..fdeaa7c5 100644 --- a/sccs/Cargo.toml +++ b/sccs/Cargo.toml @@ -12,7 +12,7 @@ clap.workspace = true gettext-rs.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/sccs/tests/what/mod.rs b/sccs/tests/what/mod.rs index ac07b259..23c452ea 100644 --- a/sccs/tests/what/mod.rs +++ b/sccs/tests/what/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::path::PathBuf; fn test_file_path(file_name: &str) -> PathBuf { diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 06b1d9d7..4611af77 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -8,13 +8,16 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true uname = "0.1" libc.workspace = true chrono.workspace = true +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/sys/tests/getconf/mod.rs b/sys/tests/getconf/mod.rs index 91564bf9..9b4a4aaa 100644 --- a/sys/tests/getconf/mod.rs +++ b/sys/tests/getconf/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::process::Output; fn run_getconf_test(args: Vec<&str>, expected_exit_code: i32, check_fn: fn(&TestPlan, &Output)) { diff --git a/text/Cargo.toml b/text/Cargo.toml index 120f2c1f..334b0fb4 100644 --- a/text/Cargo.toml +++ b/text/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true topological-sort = "0.2" @@ -21,6 +21,7 @@ dirs = "5.0" walkdir = "2" [dev-dependencies] +plib-testing.workspace = true proptest = "1" rand = "0.8" diff --git a/text/tests/comm/mod.rs b/text/tests/comm/mod.rs index b3277382..77cbb469 100644 --- a/text/tests/comm/mod.rs +++ b/text/tests/comm/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::fs; use std::path::PathBuf; diff --git a/text/tests/csplit/mod.rs b/text/tests/csplit/mod.rs index 6c557907..64ffa349 100644 --- a/text/tests/csplit/mod.rs +++ b/text/tests/csplit/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn csplit_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/cut/mod.rs b/text/tests/cut/mod.rs index 7df51946..1790126d 100644 --- a/text/tests/cut/mod.rs +++ b/text/tests/cut/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn cut_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/diff-tests.rs b/text/tests/diff-tests.rs index 8f159c23..42f6c8dc 100644 --- a/text/tests/diff-tests.rs +++ b/text/tests/diff-tests.rs @@ -12,7 +12,7 @@ mod constants; use constants::{EXIT_STATUS_DIFFERENCE, EXIT_STATUS_NO_DIFFERENCE}; -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{collections::HashMap, path::PathBuf, process::Stdio, sync::LazyLock}; fn diff_test(args: &[&str], expected_output: &str, expected_diff_exit_status: u8) { diff --git a/text/tests/expand/mod.rs b/text/tests/expand/mod.rs index e1c4e6b6..1f5d4ab6 100644 --- a/text/tests/expand/mod.rs +++ b/text/tests/expand/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn expand_test_noargs(test_data: &str, expected_output: &str) { run_test(TestPlan { diff --git a/text/tests/fold/mod.rs b/text/tests/fold/mod.rs index 537fd19a..9a84b6ba 100644 --- a/text/tests/fold/mod.rs +++ b/text/tests/fold/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::fs::File; use std::io::Read; use std::path::PathBuf; diff --git a/text/tests/grep/mod.rs b/text/tests/grep/mod.rs index 49ef06f6..a06aa1ce 100644 --- a/text/tests/grep/mod.rs +++ b/text/tests/grep/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; const LINES_INPUT: &str = "line_{1}\np_line_{2}_s\n line_{3} \nLINE_{4}\np_LINE_{5}_s\nl_{6}\nline_{70}\n"; diff --git a/text/tests/head/mod.rs b/text/tests/head/mod.rs index e739ff34..1da3ab45 100644 --- a/text/tests/head/mod.rs +++ b/text/tests/head/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use rand::{seq::SliceRandom, thread_rng}; /* #region Normal tests */ @@ -121,7 +121,7 @@ fn test_head_c() { /* #region Property-based tests */ mod property_tests { - use plib::testing::run_test_base; + use plib_testing::run_test_base; use proptest::{prelude::TestCaseError, prop_assert, test_runner::TestRunner}; use std::{ sync::mpsc::{self, RecvTimeoutError}, diff --git a/text/tests/join/mod.rs b/text/tests/join/mod.rs index b95564ca..bae81203 100644 --- a/text/tests/join/mod.rs +++ b/text/tests/join/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn run_test_join( args: &[&str], diff --git a/text/tests/nl/mod.rs b/text/tests/nl/mod.rs index 151423b2..43cd6d2c 100644 --- a/text/tests/nl/mod.rs +++ b/text/tests/nl/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn nl_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/paste/mod.rs b/text/tests/paste/mod.rs index b7883e83..a296e0f3 100644 --- a/text/tests/paste/mod.rs +++ b/text/tests/paste/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; +use plib_testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; use std::fs; use std::path::PathBuf; diff --git a/text/tests/pr/mod.rs b/text/tests/pr/mod.rs index 18ad6006..a60a2260 100644 --- a/text/tests/pr/mod.rs +++ b/text/tests/pr/mod.rs @@ -9,7 +9,7 @@ // use chrono::{DateTime, Local}; -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use regex::Regex; use std::fs; use std::io::Read; diff --git a/text/tests/sort/mod.rs b/text/tests/sort/mod.rs index 1474283e..994a45d7 100644 --- a/text/tests/sort/mod.rs +++ b/text/tests/sort/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn sort_test( args: &[&str], diff --git a/text/tests/tail/mod.rs b/text/tests/tail/mod.rs index 1b316c20..6104fe83 100644 --- a/text/tests/tail/mod.rs +++ b/text/tests/tail/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; +use plib_testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; fn tail_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args = args.iter().map(|st| (*st).to_owned()).collect::>(); diff --git a/text/tests/tr/mod.rs b/text/tests/tr/mod.rs index 1dde9487..e67519a6 100644 --- a/text/tests/tr/mod.rs +++ b/text/tests/tr/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; +use plib_testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; fn tr_test_binary(args: &[&str], test_data: &[u8], expected_output: &[u8]) { let str_args = args diff --git a/text/tests/unexpand/mod.rs b/text/tests/unexpand/mod.rs index 31d40f0c..92430fbf 100644 --- a/text/tests/unexpand/mod.rs +++ b/text/tests/unexpand/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn unexpand_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/uniq/mod.rs b/text/tests/uniq/mod.rs index e94d0626..39195695 100644 --- a/text/tests/uniq/mod.rs +++ b/text/tests/uniq/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn uniq_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/wc/mod.rs b/text/tests/wc/mod.rs index 0b8a20e1..58c6cd36 100644 --- a/text/tests/wc/mod.rs +++ b/text/tests/wc/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn wc_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/tree/Cargo.toml b/tree/Cargo.toml index c1d47409..5240c5f7 100644 --- a/tree/Cargo.toml +++ b/tree/Cargo.toml @@ -8,8 +8,8 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } -ftw = { path = "../ftw" } +plib.workspace = true +ftw.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true @@ -18,6 +18,7 @@ chrono.workspace = true errno.workspace = true [dev-dependencies] +plib-testing.workspace = true tempfile = "3.10" [features] diff --git a/tree/tests/cp/mod.rs b/tree/tests/cp/mod.rs index 6ccc0d97..fccb441b 100644 --- a/tree/tests/cp/mod.rs +++ b/tree/tests/cp/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::ffi::CString; use std::io::{Read, Write}; use std::os::unix::fs::FileTypeExt; diff --git a/tree/tests/integration2.rs b/tree/tests/integration2.rs index 54b3a0b0..beb177d8 100644 --- a/tree/tests/integration2.rs +++ b/tree/tests/integration2.rs @@ -11,7 +11,7 @@ //! newly created files in `integration.rs`. They are located here in //! `integration2.rs` because umask is a per-process. -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::fs; use std::os::unix::fs::{DirBuilderExt, MetadataExt, PermissionsExt}; use std::path::Path; diff --git a/tree/tests/link/mod.rs b/tree/tests/link/mod.rs index 31e12ef9..54a67d0b 100644 --- a/tree/tests/link/mod.rs +++ b/tree/tests/link/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::fs; use std::io::Write; use std::path::PathBuf; diff --git a/tree/tests/ls/mod.rs b/tree/tests/ls/mod.rs index 284f18bd..a4c1dd1a 100644 --- a/tree/tests/ls/mod.rs +++ b/tree/tests/ls/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use regex::Regex; use std::ffi::CString; use std::fs; diff --git a/tree/tests/mkdir/mod.rs b/tree/tests/mkdir/mod.rs index 50f96434..94d8bfd1 100644 --- a/tree/tests/mkdir/mod.rs +++ b/tree/tests/mkdir/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::fs; use std::path::Path; use std::process::Output; diff --git a/tree/tests/mv/mod.rs b/tree/tests/mv/mod.rs index 01ff29b8..6d705306 100644 --- a/tree/tests/mv/mod.rs +++ b/tree/tests/mv/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::ffi::CString; use std::fs::{self, Permissions}; use std::io::{self, Read, Write}; diff --git a/tree/tests/readlink/mod.rs b/tree/tests/readlink/mod.rs index 644b39e1..22d941f1 100644 --- a/tree/tests/readlink/mod.rs +++ b/tree/tests/readlink/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::fs::File; use std::io::Write; use std::os::unix::fs::symlink; diff --git a/tree/tests/rm/mod.rs b/tree/tests/rm/mod.rs index f8496dc3..12d8976b 100644 --- a/tree/tests/rm/mod.rs +++ b/tree/tests/rm/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use std::ffi::CString; use std::fs; use std::io::{self, Write}; diff --git a/tree/tests/rmdir/mod.rs b/tree/tests/rmdir/mod.rs index de82ac45..84ef8b9b 100644 --- a/tree/tests/rmdir/mod.rs +++ b/tree/tests/rmdir/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::fs; use std::path::Path; use std::process::Output; diff --git a/tree/tests/unlink/mod.rs b/tree/tests/unlink/mod.rs index c60c96c6..e8584336 100644 --- a/tree/tests/unlink/mod.rs +++ b/tree/tests/unlink/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use std::fs; use tempfile::tempdir; diff --git a/users/Cargo.toml b/users/Cargo.toml index 5debb689..5c7009d7 100644 --- a/users/Cargo.toml +++ b/users/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true @@ -18,10 +18,12 @@ libcrypt-rs = "0.1" thiserror = "1.0" binrw = "0.14" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true - [[bin]] name = "id" path = "./id.rs" diff --git a/xform/Cargo.toml b/xform/Cargo.toml index 8d8c291e..423bfd7a 100644 --- a/xform/Cargo.toml +++ b/xform/Cargo.toml @@ -8,12 +8,15 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true libc.workspace = true gettext-rs.workspace = true base64 = "0.21" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/xform/tests/cksum/mod.rs b/xform/tests/cksum/mod.rs index 83cdbf5e..7fda90bb 100644 --- a/xform/tests/cksum/mod.rs +++ b/xform/tests/cksum/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn cksum_test(test_data: &str, expected_output: &str) { run_test(TestPlan { diff --git a/xform/tests/compress/mod.rs b/xform/tests/compress/mod.rs index cdd00915..553deceb 100644 --- a/xform/tests/compress/mod.rs +++ b/xform/tests/compress/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{ fs::{remove_file, File}, io::Read, diff --git a/xform/tests/uue/mod.rs b/xform/tests/uue/mod.rs index 022a39bc..ed71e1ed 100644 --- a/xform/tests/uue/mod.rs +++ b/xform/tests/uue/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{ fs::{File, Permissions}, io::Read, From 440f7c8732b10d487aee66c2abf5189651387910 Mon Sep 17 00:00:00 2001 From: fox0 <15684995+fox0@users.noreply.github.com> Date: Sun, 1 Dec 2024 15:51:09 +0700 Subject: [PATCH 2/2] more/chgrp: Rename plib-testing --- Cargo.lock | 3 +-- display/tests/more/mod.rs | 2 +- tree/tests/chgrp/mod.rs | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb85ba48..fce12b33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1364,9 +1364,8 @@ version = "0.2.2" dependencies = [ "clap", "gettext-rs", - "plib-testing", "libc", - "plib", + "plib-testing", "termion", "thiserror", ] diff --git a/display/tests/more/mod.rs b/display/tests/more/mod.rs index a1b3cc14..efca52fa 100644 --- a/display/tests/more/mod.rs +++ b/display/tests/more/mod.rs @@ -9,7 +9,7 @@ use std::process::Output; -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; fn test_checker_more(plan: &TestPlan, output: &Output) { let stdout = String::from_utf8_lossy(&output.stdout); diff --git a/tree/tests/chgrp/mod.rs b/tree/tests/chgrp/mod.rs index c6d82372..dd80c16d 100644 --- a/tree/tests/chgrp/mod.rs +++ b/tree/tests/chgrp/mod.rs @@ -7,7 +7,6 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; use std::{ ffi::{CStr, CString}, fs, io, @@ -20,6 +19,8 @@ use std::{ time::Duration, }; +use plib_testing::{run_test, TestPlan}; + fn chgrp_test(args: &[&str], expected_output: &str, expected_error: &str, expected_exit_code: i32) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect();