From 388650f91f3db7e958f88e7e48d31f0eb23d0b35 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Aug 2026 21:31:00 +0200 Subject: [PATCH] dd: move the test-only parse shim into the unit tests --- src/uu/dd/src/parseargs.rs | 13 ------------- src/uu/dd/src/parseargs/unit_tests.rs | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/uu/dd/src/parseargs.rs b/src/uu/dd/src/parseargs.rs index cf123f250cf..8acf1830ddc 100644 --- a/src/uu/dd/src/parseargs.rs +++ b/src/uu/dd/src/parseargs.rs @@ -130,19 +130,6 @@ impl Parser { Self::default() } - /// Parse the operands, keeping only the error itself. - /// - /// The utility itself goes through [`Self::parse_with_diagnostics`], which - /// also knows which operand failed; this is the plain form the unit tests - /// compare against. - #[cfg(test)] - pub(crate) fn parse( - self, - operands: impl IntoIterator>, - ) -> Result { - self.read(operands).map_err(|(_, error)| error)?.validate() - } - /// Parse the operands, pointing a caret at the one that is at fault. /// /// # Arguments diff --git a/src/uu/dd/src/parseargs/unit_tests.rs b/src/uu/dd/src/parseargs/unit_tests.rs index cde0ef0cc1f..9e5c9871b10 100644 --- a/src/uu/dd/src/parseargs/unit_tests.rs +++ b/src/uu/dd/src/parseargs/unit_tests.rs @@ -12,6 +12,19 @@ use crate::conversion_tables::{ }; use crate::parseargs::Parser; +impl Parser { + /// Parse the operands, keeping only the error itself. + /// + /// The utility goes through `parse_with_diagnostics`, which also knows + /// which operand failed; this is the plain form the tests compare against. + pub(crate) fn parse( + self, + operands: impl IntoIterator>, + ) -> Result { + self.read(operands).map_err(|(_, error)| error)?.validate() + } +} + #[cfg(not(any(target_os = "linux", target_os = "android")))] #[allow(clippy::useless_vec)] #[test]