mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 12:59:12 +02:00
Rust 1.85, edition=2024 (#15741)
This commit is contained in:
@ -17,7 +17,10 @@ fn find_with_list_search_with_char() {
|
||||
let actual = nu!("[moe larry curly] | find l | to json -r");
|
||||
let actual_no_highlight = nu!("[moe larry curly] | find --no-highlight l | to json -r");
|
||||
|
||||
assert_eq!(actual.out, "[\"\\u001b[37m\\u001b[0m\\u001b[41;37ml\\u001b[0m\\u001b[37marry\\u001b[0m\",\"\\u001b[37mcur\\u001b[0m\\u001b[41;37ml\\u001b[0m\\u001b[37my\\u001b[0m\"]");
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"[\"\\u001b[37m\\u001b[0m\\u001b[41;37ml\\u001b[0m\\u001b[37marry\\u001b[0m\",\"\\u001b[37mcur\\u001b[0m\\u001b[41;37ml\\u001b[0m\\u001b[37my\\u001b[0m\"]"
|
||||
);
|
||||
assert_eq!(actual_no_highlight.out, "[\"larry\",\"curly\"]");
|
||||
}
|
||||
|
||||
@ -25,8 +28,9 @@ fn find_with_list_search_with_char() {
|
||||
fn find_with_bytestream_search_with_char() {
|
||||
let actual =
|
||||
nu!("\"ABC\" | save foo.txt; let res = open foo.txt | find abc; rm foo.txt; $res | get 0");
|
||||
let actual_no_highlight =
|
||||
nu!("\"ABC\" | save foo.txt; let res = open foo.txt | find --no-highlight abc; rm foo.txt; $res | get 0");
|
||||
let actual_no_highlight = nu!(
|
||||
"\"ABC\" | save foo.txt; let res = open foo.txt | find --no-highlight abc; rm foo.txt; $res | get 0"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
@ -88,7 +92,10 @@ fn find_with_filepath_search_with_multiple_patterns() {
|
||||
r#"["amigos.txt","arepas.clu","los.txt","tres.txt"] | find --no-highlight arep ami | to json -r"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "[\"\\u001b[37m\\u001b[0m\\u001b[41;37mami\\u001b[0m\\u001b[37mgos.txt\\u001b[0m\",\"\\u001b[37m\\u001b[0m\\u001b[41;37marep\\u001b[0m\\u001b[37mas.clu\\u001b[0m\"]");
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"[\"\\u001b[37m\\u001b[0m\\u001b[41;37mami\\u001b[0m\\u001b[37mgos.txt\\u001b[0m\",\"\\u001b[37m\\u001b[0m\\u001b[41;37marep\\u001b[0m\\u001b[37mas.clu\\u001b[0m\"]"
|
||||
);
|
||||
assert_eq!(actual_no_highlight.out, "[\"amigos.txt\",\"arepas.clu\"]");
|
||||
}
|
||||
|
||||
@ -158,8 +165,12 @@ fn inverted_find_in_table_keeps_row_if_none_of_the_selected_columns_matches() {
|
||||
|
||||
#[test]
|
||||
fn find_in_table_keeps_row_with_single_matched_and_keeps_other_columns() {
|
||||
let actual = nu!("[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18]] | find Maurice");
|
||||
let actual_no_highlight = nu!("[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18]] | find --no-highlight Maurice");
|
||||
let actual = nu!(
|
||||
"[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18]] | find Maurice"
|
||||
);
|
||||
let actual_no_highlight = nu!(
|
||||
"[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18]] | find --no-highlight Maurice"
|
||||
);
|
||||
|
||||
println!("{:?}", actual.out);
|
||||
assert!(actual.out.contains("moe"));
|
||||
@ -174,8 +185,12 @@ fn find_in_table_keeps_row_with_single_matched_and_keeps_other_columns() {
|
||||
|
||||
#[test]
|
||||
fn find_in_table_keeps_row_with_multiple_matched_and_keeps_other_columns() {
|
||||
let actual = nu!("[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18] [William bill 60]] | find moe William");
|
||||
let actual_no_highlight = nu!("[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18] [William bill 60]] | find --no-highlight moe William");
|
||||
let actual = nu!(
|
||||
"[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18] [William bill 60]] | find moe William"
|
||||
);
|
||||
let actual_no_highlight = nu!(
|
||||
"[[name nickname Age]; [Maurice moe 23] [Laurence larry 67] [William will 18] [William bill 60]] | find --no-highlight moe William"
|
||||
);
|
||||
|
||||
println!("{:?}", actual.out);
|
||||
assert!(actual.out.contains("moe"));
|
||||
|
Reference in New Issue
Block a user