mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Remove L! from sprintf calls
Remove unnecessary L!
This commit is contained in:
parent
1da9af781c
commit
0a92d03498
22 changed files with 72 additions and 75 deletions
|
@ -2570,7 +2570,7 @@ impl<'a> TokenStream<'a> {
|
|||
result.keyword = keyword_for_token(token.type_, text);
|
||||
result.has_dash_prefix = text.starts_with('-');
|
||||
result.is_help_argument = [L!("-h"), L!("--help")].contains(&text);
|
||||
result.is_newline = result.typ == ParseTokenType::end && text == L!("\n");
|
||||
result.is_newline = result.typ == ParseTokenType::end && text == "\n";
|
||||
result.may_be_variable_assignment = variable_assignment_equals_pos(text).is_some();
|
||||
result.tok_error = token.error;
|
||||
|
||||
|
@ -2920,14 +2920,14 @@ impl<'s> NodeVisitorMut for Populator<'s> {
|
|||
fn keywords_user_presentable_description(kws: &'static [ParseKeyword]) -> WString {
|
||||
assert!(!kws.is_empty(), "Should not be empty list");
|
||||
if kws.len() == 1 {
|
||||
return sprintf!(L!("keyword '%ls'"), kws[0]);
|
||||
return sprintf!("keyword '%ls'", kws[0]);
|
||||
}
|
||||
let mut res = L!("keywords ").to_owned();
|
||||
for (i, kw) in kws.iter().enumerate() {
|
||||
if i != 0 {
|
||||
res += L!(" or ");
|
||||
}
|
||||
res += &sprintf!(L!("'%ls'"), *kw)[..];
|
||||
res += &sprintf!("'%ls'", *kw)[..];
|
||||
}
|
||||
res
|
||||
}
|
||||
|
|
|
@ -187,8 +187,8 @@ fn evaluate_expression(
|
|||
|
||||
streams
|
||||
.err
|
||||
.append(sprintf!(L!("%ls: Error: %ls\n"), cmd, error_message));
|
||||
streams.err.append(sprintf!(L!("'%ls'\n"), expression));
|
||||
.append(sprintf!("%ls: Error: %ls\n", cmd, error_message));
|
||||
streams.err.append(sprintf!("'%ls'\n", expression));
|
||||
|
||||
STATUS_CMD_ERROR
|
||||
}
|
||||
|
@ -198,15 +198,13 @@ fn evaluate_expression(
|
|||
cmd,
|
||||
err.kind.describe_wstr()
|
||||
));
|
||||
streams.err.append(sprintf!(L!("'%ls'\n"), expression));
|
||||
streams.err.append(sprintf!("'%ls'\n", expression));
|
||||
let padding = WString::from_chars(vec![' '; err.position + 1]);
|
||||
if err.len >= 2 {
|
||||
let tildes = WString::from_chars(vec!['~'; err.len - 2]);
|
||||
streams
|
||||
.err
|
||||
.append(sprintf!(L!("%ls^%ls^\n"), padding, tildes));
|
||||
streams.err.append(sprintf!("%ls^%ls^\n", padding, tildes));
|
||||
} else {
|
||||
streams.err.append(sprintf!(L!("%ls^\n"), padding));
|
||||
streams.err.append(sprintf!("%ls^\n", padding));
|
||||
}
|
||||
|
||||
STATUS_CMD_ERROR
|
||||
|
|
|
@ -842,7 +842,7 @@ fn builtin_generic(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr])
|
|||
|
||||
// Hackish - if we have no arguments other than the command, we are a "naked invocation" and we
|
||||
// just print help.
|
||||
if argc == 1 || argv[0] == L!("time") {
|
||||
if argc == 1 || argv[0] == "time" {
|
||||
builtin_print_help(parser, streams, argv[0]);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ fn builtin_break_continue(
|
|||
streams: &mut IoStreams,
|
||||
argv: &mut [&wstr],
|
||||
) -> Option<c_int> {
|
||||
let is_break = argv[0] == L!("break");
|
||||
let is_break = argv[0] == "break";
|
||||
let argc = argv.len();
|
||||
|
||||
if argc != 1 {
|
||||
|
|
|
@ -33,7 +33,7 @@ pub fn source(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> O
|
|||
let func_filename;
|
||||
let optind = opts.optind;
|
||||
|
||||
if argc == optind || args[optind] == L!("-") {
|
||||
if argc == optind || args[optind] == "-" {
|
||||
if streams.stdin_fd < 0 {
|
||||
streams
|
||||
.err
|
||||
|
|
|
@ -88,7 +88,7 @@ pub fn r#type(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> O
|
|||
|
||||
if path.is_empty() {
|
||||
comment.push_utfstr(&wgettext!("Defined interactively"));
|
||||
} else if path == L!("-") {
|
||||
} else if path == "-" {
|
||||
comment.push_utfstr(&wgettext!("Defined via `source`"));
|
||||
} else {
|
||||
let lineno: i32 = props.definition_lineno();
|
||||
|
@ -103,7 +103,7 @@ pub fn r#type(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> O
|
|||
let path = props.copy_definition_file().unwrap_or(L!(""));
|
||||
if path.is_empty() {
|
||||
comment.push_utfstr(&wgettext!(", copied interactively"));
|
||||
} else if path == L!("-") {
|
||||
} else if path == "-" {
|
||||
comment.push_utfstr(&wgettext!(", copied via `source`"));
|
||||
} else {
|
||||
let lineno = props.copy_definition_lineno();
|
||||
|
|
|
@ -1564,7 +1564,7 @@ pub fn reformat_for_screen(msg: &wstr, termsize: &Termsize) -> WString {
|
|||
if line_width != 0 {
|
||||
buff.push('\n');
|
||||
}
|
||||
buff += &sprintf!(L!("%ls-\n"), token)[..];
|
||||
buff += &sprintf!("%ls-\n", token)[..];
|
||||
line_width = 0;
|
||||
} else {
|
||||
// Print the token.
|
||||
|
|
|
@ -766,7 +766,7 @@ impl<'ctx> Completer<'ctx> {
|
|||
|
||||
// Check to see if we have a preceding double-dash.
|
||||
for tok in &tokens[..tokens.len() - 1] {
|
||||
if tok.get_source(&cmdline) == L!("--") {
|
||||
if tok.get_source(&cmdline) == "--" {
|
||||
had_ddash = true;
|
||||
break;
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ impl<'ctx> Completer<'ctx> {
|
|||
|
||||
// Hack. If we're cd, handle it specially (issue #1059, others).
|
||||
handle_as_special_cd =
|
||||
exp_command == L!("cd") || arg_data.visited_wrapped_commands.contains(L!("cd"));
|
||||
exp_command == "cd" || arg_data.visited_wrapped_commands.contains(L!("cd"));
|
||||
}
|
||||
|
||||
// Maybe apply variable assignments.
|
||||
|
@ -1607,7 +1607,7 @@ impl<'ctx> Completer<'ctx> {
|
|||
if self.flags.descriptions && self.flags.autosuggestion {
|
||||
// $history can be huge, don't put all of it in the completion description; see
|
||||
// #6288.
|
||||
if env_name == L!("history") {
|
||||
if env_name == "history" {
|
||||
let history = History::with_name(&history_session_id(self.ctx.vars()));
|
||||
for i in 1..std::cmp::min(history.size(), 64) {
|
||||
if i > 1 {
|
||||
|
|
16
src/env/environment_impl.rs
vendored
16
src/env/environment_impl.rs
vendored
|
@ -342,12 +342,12 @@ impl EnvScopedImpl {
|
|||
return None;
|
||||
}
|
||||
|
||||
if key == L!("PWD") {
|
||||
if key == "PWD" {
|
||||
Some(EnvVar::new(
|
||||
self.perproc_data.pwd.clone(),
|
||||
EnvVarFlags::EXPORT,
|
||||
))
|
||||
} else if key == L!("history") {
|
||||
} else if key == "history" {
|
||||
// Big hack. We only allow getting the history on the main thread. Note that history_t
|
||||
// may ask for an environment variable, so don't take the lock here (we don't need it).
|
||||
if !is_main_thread() {
|
||||
|
@ -362,35 +362,35 @@ impl EnvScopedImpl {
|
|||
L!("history"),
|
||||
history.get_history(),
|
||||
));
|
||||
} else if key == L!("fish_killring") {
|
||||
} else if key == "fish_killring" {
|
||||
Some(EnvVar::new_from_name_vec(
|
||||
L!("fish_killring"),
|
||||
kill_entries(),
|
||||
))
|
||||
} else if key == L!("pipestatus") {
|
||||
} else if key == "pipestatus" {
|
||||
let js = &self.perproc_data.statuses;
|
||||
let mut result = Vec::with_capacity(js.pipestatus.len());
|
||||
for i in &js.pipestatus {
|
||||
result.push(i.to_wstring());
|
||||
}
|
||||
Some(EnvVar::new_from_name_vec(L!("pipestatus"), result))
|
||||
} else if key == L!("status") {
|
||||
} else if key == "status" {
|
||||
let js = &self.perproc_data.statuses;
|
||||
Some(EnvVar::new_from_name(L!("status"), js.status.to_wstring()))
|
||||
} else if key == L!("status_generation") {
|
||||
} else if key == "status_generation" {
|
||||
let status_generation = reader_status_count();
|
||||
Some(EnvVar::new_from_name(
|
||||
L!("status_generation"),
|
||||
status_generation.to_wstring(),
|
||||
))
|
||||
} else if key == L!("fish_kill_signal") {
|
||||
} else if key == "fish_kill_signal" {
|
||||
let js = &self.perproc_data.statuses;
|
||||
let signal = js.kill_signal.map_or(0, |ks| ks.code());
|
||||
Some(EnvVar::new_from_name(
|
||||
L!("fish_kill_signal"),
|
||||
signal.to_wstring(),
|
||||
))
|
||||
} else if key == L!("umask") {
|
||||
} else if key == "umask" {
|
||||
// note umask() is an absurd API: you call it to set the value and it returns the old
|
||||
// value. Thus we have to call it twice, to reset the value. The env_lock protects
|
||||
// against races. Guess what the umask is; if we guess right we don't need to reset it.
|
||||
|
|
|
@ -98,7 +98,7 @@ impl EventDescription {
|
|||
EventDescription::ProcessExit { .. }
|
||||
| EventDescription::JobExit { .. }
|
||||
| EventDescription::CallerExit { .. }
|
||||
if filter == L!("exit") =>
|
||||
if filter == "exit" =>
|
||||
{
|
||||
true
|
||||
}
|
||||
|
|
|
@ -635,7 +635,7 @@ fn expand_variables(
|
|||
// this way (it cannot be shadowed, etc).
|
||||
let mut history = None;
|
||||
let mut var = None;
|
||||
if var_name == L!("history") {
|
||||
if var_name == "history" {
|
||||
history = Some(History::with_name(&history_session_id(vars)));
|
||||
} else if var_name.as_char_slice() != [VARIABLE_EXPAND_EMPTY] {
|
||||
var = vars.get(var_name);
|
||||
|
|
|
@ -335,7 +335,7 @@ pub fn autosuggest_validate_from_history(
|
|||
};
|
||||
|
||||
// We handle cd specially.
|
||||
if parsed_command == L!("cd") && !cd_dir.is_empty() {
|
||||
if parsed_command == "cd" && !cd_dir.is_empty() {
|
||||
if expand_one(&mut cd_dir, ExpandFlags::SKIP_CMDSUBST, ctx, None) {
|
||||
if string_prefixes_string(&cd_dir, L!("--help"))
|
||||
|| string_prefixes_string(&cd_dir, L!("-h"))
|
||||
|
@ -809,7 +809,7 @@ pub fn is_potential_path(
|
|||
// We do not end with a slash; it does not have to be a directory.
|
||||
let dir_name = wdirname(&abs_path);
|
||||
let filename_fragment = wbasename(&abs_path);
|
||||
if dir_name == L!("/") && filename_fragment == L!("/") {
|
||||
if dir_name == "/" && filename_fragment == "/" {
|
||||
// cd ///.... No autosuggestion.
|
||||
return true;
|
||||
}
|
||||
|
@ -1231,7 +1231,7 @@ impl<'s> Highlighter<'s> {
|
|||
let target_path = path_apply_working_directory(&target, &self.working_directory);
|
||||
match oper.mode {
|
||||
RedirectionMode::fd => {
|
||||
if target == L!("-") {
|
||||
if target == "-" {
|
||||
target_is_valid = true;
|
||||
} else {
|
||||
target_is_valid = match fish_wcstoi(&target) {
|
||||
|
@ -1373,8 +1373,8 @@ impl<'s> Highlighter<'s> {
|
|||
|
||||
// Color arguments and redirections.
|
||||
// Except if our command is 'cd' we have special logic for how arguments are colored.
|
||||
let is_cd = expanded_cmd == L!("cd");
|
||||
let mut is_set = expanded_cmd == L!("set");
|
||||
let is_cd = expanded_cmd == "cd";
|
||||
let mut is_set = expanded_cmd == "set";
|
||||
// If we have seen a "--" argument, color all options from then on as normal arguments.
|
||||
let mut have_dashdash = false;
|
||||
for v in &stmt.args_or_redirs {
|
||||
|
@ -1387,7 +1387,7 @@ impl<'s> Highlighter<'s> {
|
|||
}
|
||||
}
|
||||
self.visit_argument(v.argument(), is_cd, !have_dashdash);
|
||||
if v.argument().source(self.buff) == L!("--") {
|
||||
if v.argument().source(self.buff) == "--" {
|
||||
have_dashdash = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -95,16 +95,16 @@ fn test_killring() {
|
|||
|
||||
assert!(kr.entries() == [L!("c"), L!("b"), L!("a")]);
|
||||
|
||||
assert!(kr.yank_rotate() == L!("b"));
|
||||
assert!(kr.yank_rotate() == "b");
|
||||
assert!(kr.entries() == [L!("b"), L!("a"), L!("c")]);
|
||||
|
||||
assert!(kr.yank_rotate() == L!("a"));
|
||||
assert!(kr.yank_rotate() == "a");
|
||||
assert!(kr.entries() == [L!("a"), L!("c"), L!("b")]);
|
||||
|
||||
kr.add(WString::from_str("d"));
|
||||
|
||||
assert!((kr.entries() == [L!("d"), L!("a"), L!("c"), L!("b")]));
|
||||
|
||||
assert!(kr.yank_rotate() == L!("a"));
|
||||
assert!(kr.yank_rotate() == "a");
|
||||
assert!((kr.entries() == [L!("a"), L!("c"), L!("b"), L!("d")]));
|
||||
}
|
||||
|
|
|
@ -585,7 +585,7 @@ impl Pager {
|
|||
self.unfiltered_completion_infos = process_completions_into_infos(raw_completions);
|
||||
|
||||
// Maybe join them.
|
||||
if self.prefix == L!("-") {
|
||||
if self.prefix == "-" {
|
||||
join_completions(&mut self.unfiltered_completion_infos);
|
||||
}
|
||||
|
||||
|
|
|
@ -244,24 +244,24 @@ impl printf_compat::args::ToArg<'static> for ParseKeyword {
|
|||
impl From<&wstr> for ParseKeyword {
|
||||
fn from(s: &wstr) -> Self {
|
||||
match s {
|
||||
_ if s == L!("!") => ParseKeyword::kw_exclam,
|
||||
_ if s == L!("and") => ParseKeyword::kw_and,
|
||||
_ if s == L!("begin") => ParseKeyword::kw_begin,
|
||||
_ if s == L!("builtin") => ParseKeyword::kw_builtin,
|
||||
_ if s == L!("case") => ParseKeyword::kw_case,
|
||||
_ if s == L!("command") => ParseKeyword::kw_command,
|
||||
_ if s == L!("else") => ParseKeyword::kw_else,
|
||||
_ if s == L!("end") => ParseKeyword::kw_end,
|
||||
_ if s == L!("exec") => ParseKeyword::kw_exec,
|
||||
_ if s == L!("for") => ParseKeyword::kw_for,
|
||||
_ if s == L!("function") => ParseKeyword::kw_function,
|
||||
_ if s == L!("if") => ParseKeyword::kw_if,
|
||||
_ if s == L!("in") => ParseKeyword::kw_in,
|
||||
_ if s == L!("not") => ParseKeyword::kw_not,
|
||||
_ if s == L!("or") => ParseKeyword::kw_or,
|
||||
_ if s == L!("switch") => ParseKeyword::kw_switch,
|
||||
_ if s == L!("time") => ParseKeyword::kw_time,
|
||||
_ if s == L!("while") => ParseKeyword::kw_while,
|
||||
_ if s == "!" => ParseKeyword::kw_exclam,
|
||||
_ if s == "and" => ParseKeyword::kw_and,
|
||||
_ if s == "begin" => ParseKeyword::kw_begin,
|
||||
_ if s == "builtin" => ParseKeyword::kw_builtin,
|
||||
_ if s == "case" => ParseKeyword::kw_case,
|
||||
_ if s == "command" => ParseKeyword::kw_command,
|
||||
_ if s == "else" => ParseKeyword::kw_else,
|
||||
_ if s == "end" => ParseKeyword::kw_end,
|
||||
_ if s == "exec" => ParseKeyword::kw_exec,
|
||||
_ if s == "for" => ParseKeyword::kw_for,
|
||||
_ if s == "function" => ParseKeyword::kw_function,
|
||||
_ if s == "if" => ParseKeyword::kw_if,
|
||||
_ if s == "in" => ParseKeyword::kw_in,
|
||||
_ if s == "not" => ParseKeyword::kw_not,
|
||||
_ if s == "or" => ParseKeyword::kw_or,
|
||||
_ if s == "switch" => ParseKeyword::kw_switch,
|
||||
_ if s == "time" => ParseKeyword::kw_time,
|
||||
_ if s == "while" => ParseKeyword::kw_while,
|
||||
_ => ParseKeyword::none,
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ pub fn token_type_user_presentable_description(
|
|||
keyword: ParseKeyword,
|
||||
) -> WString {
|
||||
if keyword != ParseKeyword::none {
|
||||
return sprintf!(L!("keyword: '%ls'"), keyword.to_wstr());
|
||||
return sprintf!("keyword: '%ls'", keyword.to_wstr());
|
||||
}
|
||||
match type_ {
|
||||
ParseTokenType::string => L!("a string").to_owned(),
|
||||
|
@ -418,7 +418,7 @@ pub fn token_type_user_presentable_description(
|
|||
ParseTokenType::error => L!("a parse error").to_owned(),
|
||||
ParseTokenType::tokenizer_error => L!("an incomplete token").to_owned(),
|
||||
ParseTokenType::comment => L!("a comment").to_owned(),
|
||||
_ => sprintf!(L!("a %ls"), type_.to_wstr()),
|
||||
_ => sprintf!("a %ls", type_.to_wstr()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -982,7 +982,7 @@ impl<'a> NodeVisitor<'a> for IndentVisitor<'a> {
|
|||
{
|
||||
// The newline after "begin" is optional, so it is part of the header.
|
||||
// The header is not in the indented block, so indent the newline here.
|
||||
if node.source(self.src) == L!("\n") {
|
||||
if node.source(self.src) == "\n" {
|
||||
inc = 1;
|
||||
dec = 1;
|
||||
}
|
||||
|
@ -1534,7 +1534,7 @@ fn detect_errors_in_decorated_statement(
|
|||
}
|
||||
|
||||
// Similarly for time (#8841).
|
||||
if command == L!("time") {
|
||||
if command == "time" {
|
||||
errored = append_syntax_error!(
|
||||
parse_errors,
|
||||
source_start,
|
||||
|
@ -1549,7 +1549,7 @@ fn detect_errors_in_decorated_statement(
|
|||
// to avoid people trying `if $status`.
|
||||
// We see this surprisingly regularly.
|
||||
let com = dst.command.source(buff_src);
|
||||
if com == L!("$status") {
|
||||
if com == "$status" {
|
||||
errored = append_syntax_error!(
|
||||
parse_errors,
|
||||
source_start,
|
||||
|
@ -1615,7 +1615,7 @@ fn detect_errors_in_decorated_statement(
|
|||
}
|
||||
|
||||
if !found_loop {
|
||||
errored = if command == L!("break") {
|
||||
errored = if command == "break" {
|
||||
append_syntax_error!(
|
||||
parse_errors,
|
||||
source_start,
|
||||
|
|
|
@ -405,7 +405,7 @@ pub fn path_as_implicit_cd(path: &wstr, wd: &wstr, vars: &dyn Environment) -> Op
|
|||
|| exp_path.starts_with(L!("./"))
|
||||
|| exp_path.starts_with(L!("../"))
|
||||
|| exp_path.ends_with(L!("/"))
|
||||
|| exp_path == L!("..")
|
||||
|| exp_path == ".."
|
||||
{
|
||||
// These paths can be implicit cd, so see if you cd to the path. Note that a single period
|
||||
// cannot (that's used for sourcing files anyways).
|
||||
|
|
|
@ -74,7 +74,7 @@ impl RedirectionSpec {
|
|||
}
|
||||
/// \return if this is a close-type redirection.
|
||||
pub fn is_close(&self) -> bool {
|
||||
self.mode == RedirectionMode::fd && self.target == L!("-")
|
||||
self.mode == RedirectionMode::fd && self.target == "-"
|
||||
}
|
||||
|
||||
/// Attempt to parse target as an fd.
|
||||
|
|
|
@ -41,7 +41,7 @@ impl PwdEnvironment {
|
|||
}
|
||||
impl Environment for PwdEnvironment {
|
||||
fn getf(&self, name: &wstr, mode: EnvMode) -> Option<EnvVar> {
|
||||
if name == L!("PWD") {
|
||||
if name == "PWD" {
|
||||
return Some(EnvVar::new(wgetcwd(), EnvVarFlags::default()));
|
||||
}
|
||||
self.parent.getf(name, mode)
|
||||
|
@ -49,7 +49,7 @@ impl Environment for PwdEnvironment {
|
|||
|
||||
fn get_names(&self, flags: EnvMode) -> Vec<WString> {
|
||||
let mut res = self.parent.get_names(flags);
|
||||
if !res.iter().any(|n| n == L!("PWD")) {
|
||||
if !res.iter().any(|n| n == "PWD") {
|
||||
res.push(L!("PWD").to_owned());
|
||||
}
|
||||
res
|
||||
|
|
|
@ -130,7 +130,7 @@ fn test_history() {
|
|||
L!("alph").to_owned(),
|
||||
history::SearchType::Exact,
|
||||
);
|
||||
let expected = set_expected(|s| s == L!("alph"));
|
||||
let expected = set_expected(|s| s == "alph");
|
||||
test_history_matches!(searcher, expected);
|
||||
|
||||
// Items exactly matching "alph", case-insensitive.
|
||||
|
@ -141,7 +141,7 @@ fn test_history() {
|
|||
nocase,
|
||||
0,
|
||||
);
|
||||
let expected = set_expected(|s| s.to_lowercase() == L!("alph"));
|
||||
let expected = set_expected(|s| s.to_lowercase() == "alph");
|
||||
test_history_matches!(searcher, expected);
|
||||
|
||||
// Test item removal case-sensitive.
|
||||
|
|
|
@ -1109,7 +1109,7 @@ pub fn wildcard_match(
|
|||
let pattern = pattern.as_ref();
|
||||
// Hackish fix for issue #270. Prevent wildcards from matching . or .., but we must still allow
|
||||
// literal matches.
|
||||
if leading_dots_fail_to_match && (name == L!(".") || name == L!("..")) {
|
||||
if leading_dots_fail_to_match && (name == "." || name == "..") {
|
||||
// The string is '.' or '..' so the only possible match is an exact match.
|
||||
return name == pattern;
|
||||
}
|
||||
|
|
|
@ -300,9 +300,9 @@ pub fn path_normalize_for_cd(wd: &wstr, path: &wstr) -> WString {
|
|||
let mut erase_count = 0;
|
||||
for comp in &path_comps {
|
||||
let mut erase_it = false;
|
||||
if comp.is_empty() || comp == L!(".") {
|
||||
if comp.is_empty() || comp == "." {
|
||||
erase_it = true;
|
||||
} else if comp == L!("..") && !wd_comps.is_empty() {
|
||||
} else if comp == ".." && !wd_comps.is_empty() {
|
||||
erase_it = true;
|
||||
wd_comps.pop();
|
||||
}
|
||||
|
|
|
@ -4,13 +4,12 @@ pub use printf_compat::sprintf;
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::wchar::L;
|
||||
|
||||
// Test basic sprintf with both literals and wide strings.
|
||||
#[test]
|
||||
fn test_sprintf() {
|
||||
assert_eq!(sprintf!("Hello, %s!", "world"), "Hello, world!");
|
||||
assert_eq!(sprintf!(L!("Hello, %ls!"), "world"), "Hello, world!");
|
||||
assert_eq!(sprintf!(L!("Hello, %ls!"), L!("world")), "Hello, world!");
|
||||
assert_eq!(sprintf!("Hello, %ls!", "world"), "Hello, world!");
|
||||
assert_eq!(sprintf!("Hello, %ls!", "world"), "Hello, world!");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue