mirror of
https://github.com/nushell/nushell.git
synced 2025-05-08 20:14:26 +02:00
Fix char lsep
assignment (#15065)
Fix `char eol` issue where there was still a hardcoded `\n` taking effect on Windows.
This commit is contained in:
parent
31e1f49cb6
commit
bfe398ca36
@ -69,7 +69,6 @@ static CHAR_MAP: LazyLock<IndexMap<&'static str, String>> = LazyLock::new(|| {
|
|||||||
"eol" => LINE_SEPARATOR_CHAR.to_string(),
|
"eol" => LINE_SEPARATOR_CHAR.to_string(),
|
||||||
"lsep" => LINE_SEPARATOR_CHAR.to_string(),
|
"lsep" => LINE_SEPARATOR_CHAR.to_string(),
|
||||||
"line_sep" => LINE_SEPARATOR_CHAR.to_string(),
|
"line_sep" => LINE_SEPARATOR_CHAR.to_string(),
|
||||||
"lsep" => '\n'.to_string(),
|
|
||||||
"esep" => ENV_PATH_SEPARATOR_CHAR.to_string(),
|
"esep" => ENV_PATH_SEPARATOR_CHAR.to_string(),
|
||||||
"env_sep" => ENV_PATH_SEPARATOR_CHAR.to_string(),
|
"env_sep" => ENV_PATH_SEPARATOR_CHAR.to_string(),
|
||||||
"tilde" => '~'.to_string(), // ~
|
"tilde" => '~'.to_string(), // ~
|
||||||
|
@ -10,3 +10,13 @@ fn test_char_list_outputs_table() {
|
|||||||
|
|
||||||
assert_eq!(actual.out, "113");
|
assert_eq!(actual.out, "113");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_char_eol() {
|
||||||
|
let actual = nu!(r#"
|
||||||
|
let expected = if ($nu.os-info.name == 'windows') { "\r\n" } else { "\n" }
|
||||||
|
((char lsep) == $expected) and ((char line_sep) == $expected) and ((char eol) == $expected)
|
||||||
|
"#);
|
||||||
|
|
||||||
|
assert_eq!(actual.out, "true");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user