mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
l10n: address review comments
This commit is contained in:
@@ -11,16 +11,17 @@ use crate::display::Quotable;
|
||||
use crate::error::{UResult, USimpleError, strip_errno};
|
||||
pub use crate::features::entries;
|
||||
use crate::show_error;
|
||||
|
||||
use clap::{Arg, ArgMatches, Command};
|
||||
|
||||
use libc::{gid_t, uid_t};
|
||||
use options::traverse;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use std::io::Error as IOError;
|
||||
use std::io::Result as IOResult;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::fs::Metadata;
|
||||
use std::io::Error as IOError;
|
||||
use std::io::Result as IOResult;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::features::tty::Teletype;
|
||||
|
||||
use std::hash::Hash;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
@@ -38,6 +39,7 @@ use std::{
|
||||
path::PathBuf,
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
|
||||
/// State or process
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
// spell-checker:disable
|
||||
|
||||
use crate::error::UError;
|
||||
|
||||
use fluent::{FluentArgs, FluentBundle, FluentResource};
|
||||
use fluent_syntax::parser::ParserError;
|
||||
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use thiserror::Error;
|
||||
use unic_langid::LanguageIdentifier;
|
||||
|
||||
|
||||
@@ -1617,7 +1617,7 @@ fn test_reading_partial_blocks_from_fifo() {
|
||||
.args(["dd", "ibs=3", "obs=3", &format!("if={fifoname}")])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.env("LANG", "C")
|
||||
.env("LC_ALL", "C")
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
@@ -1662,7 +1662,7 @@ fn test_reading_partial_blocks_from_fifo_unbuffered() {
|
||||
.args(["dd", "bs=3", "ibs=1", "obs=1", &format!("if={fifoname}")])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.env("LANG", "C")
|
||||
.env("LC_ALL", "C")
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -2550,7 +2550,6 @@ fn test_mv_selinux_context() {
|
||||
|
||||
#[test]
|
||||
fn test_mv_error_usage_display_missing_arg() {
|
||||
|
||||
new_ucmd!()
|
||||
.arg("--target-directory=.")
|
||||
.fails()
|
||||
|
||||
@@ -1630,9 +1630,9 @@ fn test_clap_localization_unknown_argument() {
|
||||
|
||||
for (locale, expected_strings) in test_cases {
|
||||
let result = new_ucmd!()
|
||||
.env("LANG", locale)
|
||||
.env("LC_ALL", locale)
|
||||
.arg("--unknown-option")
|
||||
.env("LANG", locale)
|
||||
.fails();
|
||||
|
||||
result.code_is(2); // sort uses exit code 2 for invalid options
|
||||
@@ -1647,9 +1647,9 @@ fn test_clap_localization_unknown_argument() {
|
||||
fn test_clap_localization_help_message() {
|
||||
// Test help message in English
|
||||
let result_en = new_ucmd!()
|
||||
.env("LANG", "en_US.UTF-8")
|
||||
.env("LC_ALL", "en_US.UTF-8")
|
||||
.arg("--help")
|
||||
.env("LANG", "en_US.UTF-8")
|
||||
.succeeds();
|
||||
|
||||
let stdout_en = result_en.stdout_str();
|
||||
@@ -1658,9 +1658,9 @@ fn test_clap_localization_help_message() {
|
||||
|
||||
// Test help message in French
|
||||
let result_fr = new_ucmd!()
|
||||
.env("LANG", "fr_FR.UTF-8")
|
||||
.env("LC_ALL", "fr_FR.UTF-8")
|
||||
.arg("--help")
|
||||
.env("LANG", "fr_FR.UTF-8")
|
||||
.succeeds();
|
||||
|
||||
let stdout_fr = result_fr.stdout_str();
|
||||
@@ -1687,9 +1687,9 @@ fn test_clap_localization_invalid_value() {
|
||||
|
||||
for (locale, expected_message) in test_cases {
|
||||
let result = new_ucmd!()
|
||||
.env("LANG", locale)
|
||||
.env("LC_ALL", locale)
|
||||
.arg("-k")
|
||||
.env("LANG", locale)
|
||||
.arg("invalid")
|
||||
.fails();
|
||||
|
||||
@@ -1700,13 +1700,11 @@ fn test_clap_localization_invalid_value() {
|
||||
|
||||
#[test]
|
||||
fn test_clap_localization_tip_for_value_with_dash() {
|
||||
// Test tip for passing values that look like options
|
||||
let result_en = new_ucmd!()
|
||||
let test_cases = vec![
|
||||
("en_US.UTF-8", vec!["tip:", "-- --file-with-dash"]),
|
||||
("fr_FR.UTF-8", vec!["tip:", "-- --file-with-dash"]), // TODO: fix French translation
|
||||
];
|
||||
assert!(stderr_en.contains("tip:") || stderr_en.contains("conseil:"));
|
||||
|
||||
for (locale, expected_strings) in test_cases {
|
||||
let result = new_ucmd!()
|
||||
.env("LANG", locale)
|
||||
@@ -1719,9 +1717,7 @@ fn test_clap_localization_tip_for_value_with_dash() {
|
||||
for expected in expected_strings {
|
||||
assert!(stderr.contains(expected));
|
||||
}
|
||||
let result_fr = new_ucmd!()
|
||||
}
|
||||
}
|
||||
// The tip should be preserved from clap
|
||||
assert!(stderr_fr.contains("tip:") || stderr_fr.contains("conseil:"));
|
||||
}
|
||||
|
||||
/* spell-checker: enable */
|
||||
|
||||
Reference in New Issue
Block a user