repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/reject.rs | crates/nu-command/tests/commands/reject.rs | use nu_test_support::nu;
#[test]
fn regular_columns() {
let actual = nu!(r#"
echo [
[first_name, last_name, rusty_at, type];
[Andrés Robalino '10/11/2013' A]
[JT Turner '10/12/2013' B]
[Yehuda Katz '10/11/2013' A]
]
| reject type first_na... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/each.rs | crates/nu-command/tests/commands/each.rs | use nu_test_support::nu;
#[test]
fn each_works_separately() {
let actual = nu!("echo [1 2 3] | each { |it| echo $it 10 | math sum } | to json -r");
assert_eq!(actual.out, "[11,12,13]");
}
#[test]
fn each_group_works() {
let actual = nu!("echo [1 2 3 4 5 6] | chunks 3 | to json --raw");
assert_eq!(ac... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/into_filesize.rs | crates/nu-command/tests/commands/into_filesize.rs | use nu_test_support::nu;
#[test]
fn int() {
let actual = nu!("1 | into filesize");
assert!(actual.out.contains("1 B"));
}
#[test]
fn float() {
let actual = nu!("1.2 | into filesize");
assert!(actual.out.contains("1 B"));
}
#[test]
fn str() {
let actual = nu!("'2000' | into filesize");
asser... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/lines.rs | crates/nu-command/tests/commands/lines.rs | use nu_test_support::nu;
#[test]
fn lines() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open cargo_sample.toml -r
| lines
| skip while {|it| $it != "[dependencies]" }
| skip 1
| first
| split column "="
| get column0.0
| str trim
"#);
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/save.rs | crates/nu-command/tests/commands/save.rs | use nu_test_support::fs::{Stub, file_contents};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use std::io::Write;
#[test]
fn writes_out_csv() {
Playground::setup("save_test_2", |dirs, sandbox| {
sandbox.with_files(&[]);
let expected_file = dirs.test().join("cargo_sample.csv... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/du.rs | crates/nu-command/tests/commands/du.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::{nu, playground::Playground};
use rstest::rstest;
#[test]
fn test_du_flag_min_size() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
du -m -1
"#);
assert!(
actual
.err
.contains("Negative value pass... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/group_by.rs | crates/nu-command/tests/commands/group_by.rs | use nu_test_support::nu;
#[test]
fn groups() {
let sample = r#"[
[first_name, last_name, rusty_at, type];
[Andrés, Robalino, "10/11/2013", A],
[JT, Turner, "10/12/2013", B],
[Yehuda, Katz, "10/11/2013", A]
]"#;
let actual = nu!(format!(
r#"
{sample}
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/unlet.rs | crates/nu-command/tests/commands/unlet.rs | use nu_test_support::nu;
#[test]
fn unlet_basic() {
let actual = nu!("let x = 42; unlet $x; $x");
assert!(actual.err.contains("Variable not found"));
}
#[test]
fn unlet_builtin_nu() {
let actual = nu!("unlet $nu");
assert!(actual.err.contains("cannot be deleted"));
}
#[test]
fn unlet_builtin_env() ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/ulimit.rs | crates/nu-command/tests/commands/ulimit.rs | use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn limit_set_soft1() {
Playground::setup("limit_set_soft1", |dirs, _sandbox| {
let actual = nu!(cwd: dirs.test(), "
let soft = (ulimit -s | first | get soft);
ulimit -s -H $soft;
let hard = (ul... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/into_duration.rs | crates/nu-command/tests/commands/into_duration.rs | use nu_test_support::nu;
// Tests happy paths
#[test]
fn into_duration_float() {
let actual = nu!(r#"1.07min | into duration"#);
assert_eq!("1min 4sec 200ms", actual.out);
}
#[test]
fn into_duration_from_record_cell_path() {
let actual = nu!(r#"{d: '1hr'} | into duration d"#);
let expected = nu!(r#"... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/source_env.rs | crates/nu-command/tests/commands/source_env.rs | use nu_test_support::fs::Stub::{EmptyFile, FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[should_panic]
#[test]
fn sources_also_files_under_custom_lib_dirs_path() {
Playground::setup("source_test_1", |dirs, nu| {
let file = dirs.test().... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/for_.rs | crates/nu-command/tests/commands/for_.rs | use nu_test_support::nu;
#[test]
fn for_doesnt_auto_print_in_each_iteration() {
let actual = nu!("
for i in 1..2 {
$i
}");
// Make sure we don't see any of these values in the output
// As we do not auto-print loops anymore
assert!(!actual.out.contains('1'));
}
#[test]
fn f... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/sort_by.rs | crates/nu-command/tests/commands/sort_by.rs | use nu_test_support::nu;
#[test]
fn by_column() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open cargo_sample.toml --raw
| lines
| skip 1
| first 4
| split column "="
| sort-by column0
| skip 1
| first
| get column0
| str tri... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/export.rs | crates/nu-command/tests/commands/export.rs | use nu_test_support::nu;
#[test]
fn export_command_help() {
let actual = nu!("export -h");
assert!(
actual
.out
.contains("Export definitions or environment variables from a module")
);
}
#[test]
fn export_command_unexpected() {
let actual = nu!("export foo");
ass... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/length.rs | crates/nu-command/tests/commands/length.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn length_columns_in_cal_table() {
let actual = nu!("cal --as-table | columns | length");
assert_eq!(actual.out, "7");
}
#[test]
fn length_columns_no_rows() {
let actual = nu!("ec... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/roll.rs | crates/nu-command/tests/commands/roll.rs | use nu_test_support::nu;
mod rows {
use super::*;
const TABLE: &str = r#"[
[service, status];
[ruby, DOWN]
[db, DOWN]
[nud, DOWN]
[expected, HERE]
]"#;
#[test]
fn can_roll_down() {
let actual = nu!(format!(
r#"
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/seq.rs | crates/nu-command/tests/commands/seq.rs | use nu_test_support::nu;
#[test]
fn float_in_seq_leads_to_lists_of_floats() {
let actual = nu!("seq 1.0 0.5 6 | describe");
assert_eq!(actual.out, "list<float> (stream)");
}
#[test]
fn ints_in_seq_leads_to_lists_of_ints() {
let actual = nu!("seq 1 2 6 | describe");
assert_eq!(actual.out, "list<int> ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/job.rs | crates/nu-command/tests/commands/job.rs | use nu_test_support::nu;
#[test]
fn job_send_root_job_works() {
let actual = nu!(r#"
job spawn { 'beep' | job send 0 }
job recv --timeout 10sec"#);
assert_eq!(actual.out, "beep");
}
#[test]
fn job_send_background_job_works() {
let actual = nu!(r#"
let job = job spawn { job recv | ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/zip.rs | crates/nu-command/tests/commands/zip.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
const ZIP_POWERED_TEST_ASSERTION_SCRIPT: &str = r#"
export def expect [
left,
--to-eq,
right
] {
$left | zip $right | all {|row|
$row.name.0 == $row.name.1 and $row.commits.0 ==... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/generate.rs | crates/nu-command/tests/commands/generate.rs | use nu_test_support::nu;
#[test]
fn generate_no_next_break() {
let actual = nu!(
"generate {|x| if $x == 3 { {out: $x}} else { {out: $x, next: ($x + 1)} }} 1 | to nuon"
);
assert_eq!(actual.out, "[1, 2, 3]");
}
#[test]
fn generate_null_break() {
let actual = nu!("generate {|x| if $x <= 3 { {o... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/nu_check.rs | crates/nu-command/tests/commands/nu_check.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn parse_script_success() {
Playground::setup("nu_check_test_1", |dirs, sandbox| {
sandbox.with_files(&[FileWithContentToBeTrimmed(
"script.nu",
r... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/exec.rs | crates/nu-command/tests/commands/exec.rs | use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn basic_exec() {
Playground::setup("test_exec_1", |dirs, _| {
let actual = nu!(cwd: dirs.test(), r#"
nu -n -c 'exec nu --testbin cococo a b c'
"#);
assert_eq!(actual.out, "a b c");
})
}
#[test]
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/start.rs | crates/nu-command/tests/commands/start.rs | use super::*;
use nu_engine::test_help::{convert_single_value_to_cmd_args, eval_block_with_input};
use nu_engine::{current_dir, eval_expression};
use nu_protocol::{
PipelineData, Span, Spanned, Type, Value,
ast::Call,
engine::{EngineState, Stack, StateWorkingSet},
};
use std::path::PathBuf;
/// Create a mi... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/seq_date.rs | crates/nu-command/tests/commands/seq_date.rs | use nu_test_support::nu;
#[test]
fn fails_on_datetime_input() {
let actual = nu!("seq date --begin-date (date now)");
assert!(actual.err.contains("Type mismatch"))
}
#[test]
fn fails_when_increment_not_integer_or_duration() {
let actual = nu!("seq date --begin-date 2020-01-01 --increment 1.1");
asse... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/histogram.rs | crates/nu-command/tests/commands/histogram.rs | use nu_test_support::nu;
const SAMPLE_INPUT: &str = /* lang=nu */
r#"[
[first_name, last_name, rusty_at];
[Andrés, Robalino, Ecuador],
[JT, Turner, "Estados Unidos"],
[Yehuda, Katz, "Estados Unidos"]
]"#;
#[test]
fn summarizes_by_column_given() {
let actual = nu!(format!(
r#"
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/print.rs | crates/nu-command/tests/commands/print.rs | use nu_test_support::nu;
#[test]
fn print_to_stdout() {
let actual = nu!("print 'hello world'");
assert!(actual.out.contains("hello world"));
assert!(actual.err.is_empty());
}
#[test]
fn print_to_stderr() {
let actual = nu!("print -e 'hello world'");
assert!(actual.out.is_empty());
assert!(act... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/every.rs | crates/nu-command/tests/commands/every.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn gets_all_rows_by_every_zero() {
Playground::setup("every_test_1", |dirs, sandbox| {
sandbox.with_files(&[
EmptyFile("amigos.txt"),
EmptyFile("arepas.clu"),
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/inspect.rs | crates/nu-command/tests/commands/inspect.rs | use nu_test_support::nu;
#[test]
fn inspect_with_empty_pipeline() {
let actual = nu!("inspect");
assert!(actual.err.contains("no input value was piped in"));
}
#[test]
fn inspect_with_empty_list() {
let actual = nu!("[] | inspect");
assert!(actual.out.contains("empty list"));
}
#[test]
fn inspect_wit... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/detect_columns.rs | crates/nu-command/tests/commands/detect_columns.rs | use nu_test_support::{nu, playground::Playground};
#[test]
fn detect_columns_with_legacy() {
let cases = [(
"$\"c1 c2 c3 c4 c5(char nl)a b c d e\"",
"[[c1,c2,c3,c4,c5]; [a,b,c,d,e]]",
)];
Playground::setup("detect_columns_test_1", |dirs, _| {
for case in cases.into_iter() {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/wrap.rs | crates/nu-command/tests/commands/wrap.rs | use nu_test_support::nu;
#[test]
fn wrap_rows_into_a_row() {
let sample = r#"[
[first_name, last_name];
[Andrés, Robalino],
[JT, Turner],
[Yehuda, Katz]
]"#;
let actual = nu!(format!(
"
{sample}
| wrap caballeros
| get caballeros
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/get.rs | crates/nu-command/tests/commands/get.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn simple_get_record() {
let actual = nu!(r#"({foo: 'bar'} | get foo) == "bar""#);
assert_eq!(actual.out, "true");
}
#[test]
fn simple_get_list() {
let actual = nu!(r#"([{foo: 'bar... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/to_text.rs | crates/nu-command/tests/commands/to_text.rs | use nu_test_support::nu;
const LINE_LEN: usize = if cfg!(target_os = "windows") { 2 } else { 1 };
#[test]
fn list() {
// Using `str length` since nu! strips newlines, grr
let actual = nu!(r#"[] | to text | str length"#);
assert_eq!(actual.out, "0");
let actual = nu!(r#"[a] | to text | str length"#);
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/mktemp.rs | crates/nu-command/tests/commands/mktemp.rs | use nu_path::AbsolutePath;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn creates_temp_file() {
Playground::setup("mktemp_test_1", |dirs, _| {
let output = nu!(
cwd: dirs.test(),
"mktemp"
);
let loc = AbsolutePath::try_new(&output.ou... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/loop_.rs | crates/nu-command/tests/commands/loop_.rs | use nu_test_support::nu;
#[test]
fn loop_doesnt_auto_print_in_each_iteration() {
let actual = nu!("
mut total = 0;
loop {
if $total == 3 {
break;
} else {
$total += 1;
}
1
}");
// Make sure we don't see any ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/continue_.rs | crates/nu-command/tests/commands/continue_.rs | use nu_test_support::nu;
#[test]
fn continue_for_loop() {
let actual = nu!("for i in 1..10 { if $i == 2 { continue }; print $i }");
assert_eq!(actual.out, "1345678910");
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/str_/into_string.rs | crates/nu-command/tests/commands/str_/into_string.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn from_range() {
let actual = nu!(r#"
echo 1..5 | into string | to json -r
"#);
assert_eq!(actual.out, "[\"1\",\"2\",\"3\",\"4\",\"5\"]");
}
#[test]
fn fro... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/str_/mod.rs | crates/nu-command/tests/commands/str_/mod.rs | mod into_string;
mod join;
use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn trims() {
Playground::setup("str_test_1", |dirs, sandbox| {
sandbox.with_files(&[FileWithContent(
"sample.toml",
r#"
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/str_/join.rs | crates/nu-command/tests/commands/str_/join.rs | use nu_test_support::nu;
#[test]
fn test_1() {
let actual = nu!(r#"
echo 1..5 | into string | str join
"#);
assert_eq!(actual.out, "12345");
}
#[test]
fn test_2() {
let actual = nu!(r#"
echo [a b c d] | str join "<sep>"
"#);
assert_eq!(actual.out, "a<sep>b<sep>c<sep>d");
}
#[test]
f... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/take/until.rs | crates/nu-command/tests/commands/take/until.rs | use nu_test_support::nu;
#[test]
fn condition_is_met() {
let sample = r#"[
["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
["Yellow Chickens", "", "", ""],
[Andrés, 1, 1, 1],
[JT, 1, 1, 1],
[Jason, 1, 1, 1],
[Yehuda, 1, 1, 1],
["Blue Chicken... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/take/rows.rs | crates/nu-command/tests/commands/take/rows.rs | use nu_test_support::nu;
#[test]
fn rows() {
let sample = r#"
[[name, lucky_code];
[Andrés, 1],
[JT , 1],
[Jason , 2],
[Yehuda, 1]]"#;
let actual = nu!(format!(
r#"
{sample}
| take 3
| get lucky_code
| mat... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/take/while_.rs | crates/nu-command/tests/commands/take/while_.rs | use nu_test_support::nu;
#[test]
fn condition_is_met() {
let sample = r#"[
["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
["Yellow Chickens", "", "", ""],
[Andrés, 1, 1, 1],
[JT, 1, 1, 1],
[Jason, 1, 1, 1],
[Yehuda, 1, 1, 1],
["Blue Chicken... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/take/mod.rs | crates/nu-command/tests/commands/take/mod.rs | mod rows;
mod until;
mod while_;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/query/db.rs | crates/nu-command/tests/commands/query/db.rs | use nu_test_support::nu;
#[cfg(feature = "sqlite")]
#[test]
fn can_query_single_table() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open sample.db
| query db "select * from strings"
| where x =~ ell
| length
"#);
assert_eq!(actual.out, "4");
}
#[cfg(feature = "sq... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/query/mod.rs | crates/nu-command/tests/commands/query/mod.rs | mod db;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/base/base32hex.rs | crates/nu-command/tests/commands/base/base32hex.rs | use nu_test_support::nu;
#[test]
fn canonical() {
super::test_canonical("base32hex");
super::test_canonical("base32hex --nopad");
}
#[test]
fn const_() {
super::test_const("base32hex");
super::test_const("base32hex --nopad");
}
#[test]
fn encode() {
let text = "Ș̗͙̂̏o̲̲̗͗̌͊m̝̊̓́͂ë̡̦̞̤́̌̈́̀ ̥̝̪̎̿ͅ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/base/base64.rs | crates/nu-command/tests/commands/base/base64.rs | use nu_test_support::nu;
#[test]
fn canonical() {
super::test_canonical("base64");
super::test_canonical("base64 --url");
super::test_canonical("base64 --nopad");
super::test_canonical("base64 --url --nopad");
}
#[test]
fn const_() {
super::test_const("base64");
super::test_const("base64 --url... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/base/hex.rs | crates/nu-command/tests/commands/base/hex.rs | use nu_test_support::nu;
#[test]
fn canonical() {
super::test_canonical("hex");
}
#[test]
fn const_() {
super::test_const("hex");
}
#[test]
fn encode() {
let text = "Ș̗͙̂̏o̲̲̗͗̌͊m̝̊̓́͂ë̡̦̞̤́̌̈́̀ ̥̝̪̎̿ͅf̧̪̻͉͗̈́̍̆u̮̝͌̈́ͅn̹̞̈́̊k̮͇̟͎̂͘y̧̲̠̾̆̕ͅ ̙͖̭͔̂̐t̞́́͘e̢̨͕̽x̥͋t͍̑̔͝";
let encoded = "53CC82CC8FCCA6CC97CD99... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/base/mod.rs | crates/nu-command/tests/commands/base/mod.rs | use data_encoding::HEXUPPER;
use rand::prelude::*;
use rand::random_range;
use rand_chacha::ChaCha8Rng;
use nu_test_support::nu;
mod base32;
mod base32hex;
mod base64;
mod hex;
/// Generate a few random binaries.
fn random_bytes() -> Vec<String> {
const NUM: usize = 32;
let mut rng = ChaCha8Rng::seed_from_u6... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/base/base32.rs | crates/nu-command/tests/commands/base/base32.rs | use nu_test_support::nu;
#[test]
fn canonical() {
super::test_canonical("base32");
super::test_canonical("base32 --nopad");
}
#[test]
fn const_() {
super::test_const("base32");
super::test_const("base32 --nopad");
}
#[test]
fn encode() {
let text = "Ș̗͙̂̏o̲̲̗͗̌͊m̝̊̓́͂ë̡̦̞̤́̌̈́̀ ̥̝̪̎̿ͅf̧̪̻͉͗̈́̍̆u͌̈́... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/date/mod.rs | crates/nu-command/tests/commands/date/mod.rs | mod format;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/date/format.rs | crates/nu-command/tests/commands/date/format.rs | use nu_test_support::nu;
#[test]
fn formatter_not_valid() {
let actual = nu!(r#"
date now | format date '%N'
"#);
assert!(actual.err.contains("invalid format"));
}
#[test]
fn test_j_q_format_specifiers() {
let actual = nu!(r#"
"2021-10-22 20:00:12 +01:00" | format date '%J_%Q'
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/abs.rs | crates/nu-command/tests/commands/math/abs.rs | use nu_test_support::nu;
#[test]
fn const_abs() {
let actual = nu!("const ABS = -5.5 | math abs; $ABS");
assert_eq!(actual.out, "5.5");
}
#[test]
fn can_abs_range_into_list() {
let actual = nu!("-1.5..-10.5 | math abs");
let expected = nu!("1.5..10.5");
assert_eq!(actual.out, expected.out);
}
#[... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/median.rs | crates/nu-command/tests/commands/math/median.rs | use nu_test_support::nu;
#[test]
fn median_numbers_with_even_rows() {
let actual = nu!(r#"
echo [10 6 19 21 4]
| math median
"#);
assert_eq!(actual.out, "10")
}
#[test]
fn median_numbers_with_odd_rows() {
let actual = nu!(r#"
echo [3 8 9 12 12 15]
| math median
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/log.rs | crates/nu-command/tests/commands/math/log.rs | use nu_test_support::nu;
#[test]
fn const_log() {
let actual = nu!("const LOG = 16 | math log 2; $LOG");
assert_eq!(actual.out, "4.0");
}
#[test]
fn can_log_range_into_list() {
let actual = nu!("1..5 | math log 2");
let expected = nu!("[1 2 3 4 5] | math log 2");
assert_eq!(actual.out, expected.o... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/sum.rs | crates/nu-command/tests/commands/math/sum.rs | use nu_test_support::nu;
use std::str::FromStr;
#[test]
fn all() {
let sample = r#"{
meals: [
{description: "1 large egg", calories: 90},
{description: "1 cup white rice", calories: 250},
{description: "1 tablespoon fish oil", calories: 108}
]
}"#;
let a... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/product.rs | crates/nu-command/tests/commands/math/product.rs | use nu_test_support::nu;
#[test]
fn const_product() {
let actual = nu!("const PROD = [1 3 5] | math product; $PROD");
assert_eq!(actual.out, "15");
}
#[test]
fn cannot_product_infinite_range() {
let actual = nu!("0.. | math product");
assert!(actual.err.contains("nu::shell::incorrect_value"));
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/max.rs | crates/nu-command/tests/commands/math/max.rs | use nu_test_support::nu;
#[test]
fn const_max() {
let actual = nu!("const MAX = [1 3 5] | math max; $MAX");
assert_eq!(actual.out, "5");
}
#[test]
fn cannot_max_infinite_range() {
let actual = nu!("0.. | math max");
assert!(actual.err.contains("nu::shell::incorrect_value"));
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/round.rs | crates/nu-command/tests/commands/math/round.rs | use nu_test_support::nu;
#[test]
fn can_round_very_large_numbers() {
let actual = nu!("18.1372544780074142289927665486772012345 | math round");
assert_eq!(actual.out, "18")
}
#[test]
fn can_round_very_large_numbers_with_precision() {
let actual = nu!("18.13725447800741422899276654867720121457878988 | mat... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/min.rs | crates/nu-command/tests/commands/math/min.rs | use nu_test_support::nu;
#[test]
fn const_min() {
let actual = nu!("const MIN = [1 3 5] | math min; $MIN");
assert_eq!(actual.out, "1");
}
#[test]
fn cannot_min_infinite_range() {
let actual = nu!("0.. | math min");
assert!(actual.err.contains("nu::shell::incorrect_value"));
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/variance.rs | crates/nu-command/tests/commands/math/variance.rs | use nu_test_support::nu;
#[test]
fn const_variance() {
let actual = nu!("const VAR = [1 2 3 4 5] | math variance; $VAR");
assert_eq!(actual.out, "2.0");
}
#[test]
fn can_variance_range() {
let actual = nu!("0..5 | math variance");
let expected = nu!("[0 1 2 3 4 5] | math variance");
assert_eq!(ac... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/mod.rs | crates/nu-command/tests/commands/math/mod.rs | mod abs;
mod avg;
mod ceil;
mod floor;
mod log;
mod max;
mod median;
mod min;
mod mode;
mod product;
mod round;
mod sqrt;
mod stddev;
mod sum;
mod variance;
use nu_test_support::nu;
#[test]
fn one_arg() {
let actual = nu!(r#"
1
"#);
assert_eq!(actual.out, "1");
}
#[test]
fn add() {
let actua... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/sqrt.rs | crates/nu-command/tests/commands/math/sqrt.rs | use nu_test_support::nu;
#[test]
fn can_sqrt_numbers() {
let actual = nu!("echo [0.25 2 4] | math sqrt | math sum");
assert_eq!(actual.out, "3.914213562373095");
}
#[test]
fn can_sqrt_irrational() {
let actual = nu!("echo 2 | math sqrt");
assert_eq!(actual.out, "1.4142135623730951");
}
#[test]
fn c... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/ceil.rs | crates/nu-command/tests/commands/math/ceil.rs | use nu_test_support::nu;
#[test]
fn const_ceil() {
let actual = nu!("const CEIL = 1.5 | math ceil; $CEIL");
assert_eq!(actual.out, "2");
}
#[test]
fn can_ceil_range_into_list() {
let actual = nu!("(1.8)..(3.8) | math ceil");
let expected = nu!("[2 3 4]");
assert_eq!(actual.out, expected.out);
}
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/avg.rs | crates/nu-command/tests/commands/math/avg.rs | use nu_test_support::nu;
#[test]
fn can_average_numbers() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open sgml_description.json
| get glossary.GlossDiv.GlossList.GlossEntry.Sections
| math avg
"#);
assert_eq!(actual.out, "101.5")
}
#[test]
fn can_average_bytes() {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/mode.rs | crates/nu-command/tests/commands/math/mode.rs | use nu_test_support::nu;
#[test]
fn const_avg() {
let actual = nu!("const MODE = [1 3 3 5] | math mode; $MODE");
assert_eq!(actual.out, "╭───┬───╮│ 0 │ 3 │╰───┴───╯");
}
#[test]
fn cannot_mode_range() {
let actual = nu!("0..5 | math mode");
assert!(actual.err.contains("nu::parser::input_type_mismatch... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/floor.rs | crates/nu-command/tests/commands/math/floor.rs | use nu_test_support::nu;
#[test]
fn const_floor() {
let actual = nu!("const FLOOR = 15.5 | math floor; $FLOOR");
assert_eq!(actual.out, "15");
}
#[test]
fn can_floor_range_into_list() {
let actual = nu!("(1.8)..(3.8) | math floor");
let expected = nu!("[1 2 3]");
assert_eq!(actual.out, expected.o... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/math/stddev.rs | crates/nu-command/tests/commands/math/stddev.rs | use nu_test_support::nu;
#[test]
fn const_avg() {
let actual = nu!("const SDEV = [1 2] | math stddev; $SDEV");
assert_eq!(actual.out, "0.5");
}
#[test]
fn can_stddev_range() {
let actual = nu!("0..5 | math stddev");
let expected = nu!("[0 1 2 3 4 5] | math stddev");
assert_eq!(actual.out, expecte... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/skip/skip_.rs | crates/nu-command/tests/commands/skip/skip_.rs | use nu_test_support::nu;
#[test]
fn skips_bytes() {
let actual = nu!("(0x[aa bb cc] | skip 2) == 0x[cc]");
assert_eq!(actual.out, "true");
}
#[test]
fn skips_bytes_from_stream() {
let actual = nu!("([0 1] | each { 0x[aa bb cc] } | bytes collect | skip 2) == 0x[cc aa bb cc]");
assert_eq!(actual.out, ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/skip/until.rs | crates/nu-command/tests/commands/skip/until.rs | use nu_test_support::nu;
#[test]
fn condition_is_met() {
let sample = r#"[
["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
["Yellow Chickens", "", "", ""],
[Andrés, 0, 0, 1],
[JT, 0, 0, 1],
[Jason, 0, 0, 1],
[Yehuda, 0, 0, 1],
["Blue Chicken... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/skip/while_.rs | crates/nu-command/tests/commands/skip/while_.rs | use nu_test_support::nu;
#[test]
fn condition_is_met() {
let sample = r#"[
["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
["Yellow Chickens", "", "", ""],
[Andrés, 0, 0, 1],
[JT, 0, 0, 1],
[Jason, 0, 0, 1],
[Yehuda, 0, 0, 1],
["Blue Chicken... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/skip/mod.rs | crates/nu-command/tests/commands/skip/mod.rs | mod skip_;
mod until;
mod while_;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/conversions/mod.rs | crates/nu-command/tests/commands/conversions/mod.rs | mod into;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/conversions/into/record.rs | crates/nu-command/tests/commands/conversions/into/record.rs | use nu_test_support::nu;
#[test]
fn doesnt_accept_mixed_type_list_as_input() {
let actual = nu!("[{foo: bar} [quux baz]] | into record");
assert!(!actual.status.success());
assert!(actual.err.contains("type_mismatch"));
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/conversions/into/mod.rs | crates/nu-command/tests/commands/conversions/into/mod.rs | mod binary;
mod int;
mod record;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/conversions/into/binary.rs | crates/nu-command/tests/commands/conversions/into/binary.rs | use nu_test_support::nu;
#[test]
fn sets_stream_from_internal_command_as_binary() {
let result = nu!("seq 1 10 | to text | into binary | describe");
assert_eq!("binary (stream)", result.out);
}
#[test]
fn sets_stream_from_external_command_as_binary() {
let result = nu!("^nu --testbin cococo | into binary ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/conversions/into/int.rs | crates/nu-command/tests/commands/conversions/into/int.rs | use nu_test_support::nu;
#[test]
fn convert_back_and_forth() {
let actual = nu!(r#"1 | into binary | into int"#);
assert_eq!(actual.out, "1");
}
#[test]
fn convert_into_int_little_endian() {
let actual = nu!(r#"0x[01 00 00 00 00 00 00 00] | into int --endian little"#);
assert_eq!(actual.out, "1");
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/hash_/mod.rs | crates/nu-command/tests/commands/hash_/mod.rs | use nu_test_support::nu;
#[test]
fn base64_defaults_to_encoding_with_standard_character_type() {
let actual = nu!(r#"
echo 'username:password' | encode base64
"#);
assert_eq!(actual.out, "dXNlcm5hbWU6cGFzc3dvcmQ=");
}
#[test]
fn base64_defaults_to_encoding_with_nopad() {
let actual = nu!(... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/url/parse.rs | crates/nu-command/tests/commands/url/parse.rs | use nu_test_support::nu;
#[test]
fn url_parse_simple() {
let actual = nu!(r#"
(
"https://www.abc.com" | url parse
) == {
scheme: 'https',
username: '',
password: '',
host: 'www.abc.com',
port: '',
path: '/',
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/url/decode.rs | crates/nu-command/tests/commands/url/decode.rs | use nu_test_support::nu;
#[test]
fn url_decode_simple() {
let actual = nu!(r#"'a%20b' | url decode"#);
assert_eq!(actual.out, "a b");
}
#[test]
fn url_decode_special_characters() {
let actual = nu!(r#"'%21%40%23%24%25%C2%A8%26%2A%2D%2B%3B%2C%7B%7D%5B%5D%28%29' | url decode"#);
assert_eq!(actual.out, r... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/url/mod.rs | crates/nu-command/tests/commands/url/mod.rs | mod decode;
mod join;
mod parse;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/url/join.rs | crates/nu-command/tests/commands/url/join.rs | use nu_test_support::nu;
#[test]
fn url_join_simple() {
let actual = nu!(r#"
{
"scheme": "http",
"username": "",
"password": "",
"host": "localhost",
"port": "",
} | url join
"#);
assert_eq!(actual.... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/assignment/concat.rs | crates/nu-command/tests/commands/assignment/concat.rs | use nu_test_support::nu;
#[test]
fn concat_assign_list_int() {
let actual = nu!(r#"
mut a = [1 2];
$a ++= [3 4];
$a == [1 2 3 4]
"#);
assert_eq!(actual.out, "true")
}
#[test]
fn concat_assign_list_string() {
let actual = nu!(r#"
mut a = [a b];
$a ++= [c d];
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/assignment/mod.rs | crates/nu-command/tests/commands/assignment/mod.rs | mod concat;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/bytes/collect.rs | crates/nu-command/tests/commands/bytes/collect.rs | use nu_test_support::nu;
#[test]
fn test_stream() {
let actual = nu!("
[0x[01] 0x[02] 0x[03] 0x[04]]
| filter {true}
| bytes collect 0x[aa aa]
| encode hex
");
assert_eq!(actual.out, "01AAAA02AAAA03AAAA04");
}
#[test]
fn test_stream_type() {
let actual = nu!("
[... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/bytes/mod.rs | crates/nu-command/tests/commands/bytes/mod.rs | mod at;
mod collect;
mod length;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/bytes/at.rs | crates/nu-command/tests/commands/bytes/at.rs | use nu_test_support::nu;
#[test]
pub fn returns_error_for_relative_range_on_infinite_stream() {
let actual = nu!("nu --testbin iecho 3 | bytes at ..-3");
assert!(
actual.err.contains(
"Relative range values cannot be used with streams that don't have a known length"
),
"Expe... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/bytes/length.rs | crates/nu-command/tests/commands/bytes/length.rs | use nu_test_support::nu;
#[test]
pub fn test_basic_non_const_success() {
let actual = nu!("let a = 0x[00 00 00]; $a | bytes length");
assert_eq!(
actual.out, "3",
"Expected the length of 0x[00 00 00] to be 3 at non-const time, but got something else"
);
}
#[test]
pub fn test_basic_const_su... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/port.rs | crates/nu-command/tests/commands/network/port.rs | use nu_test_support::nu;
use std::net::TcpListener;
use std::sync::mpsc;
#[test]
fn port_with_invalid_range() {
let actual = nu!("port 4000 3999");
assert!(actual.err.contains("Invalid range"))
}
#[test]
fn port_with_already_usage() {
let retry_times = 10;
for _ in 0..retry_times {
let (tx, r... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/mod.rs | crates/nu-command/tests/commands/network/mod.rs | mod http;
mod port;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/put.rs | crates/nu-command/tests/commands/network/http/put.rs | use std::{thread, time::Duration};
use mockito::Server;
use nu_test_support::nu;
#[test]
fn http_put_is_success() {
let mut server = Server::new();
let _mock = server.mock("PUT", "/").match_body("foo").create();
let actual = nu!(format!(r#"http put {url} "foo""#, url = server.url()));
assert!(actua... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/options.rs | crates/nu-command/tests/commands/network/http/options.rs | use std::{thread, time::Duration};
use mockito::Server;
use nu_test_support::nu;
#[test]
fn http_options_is_success() {
let mut server = Server::new();
let _mock = server
.mock("OPTIONS", "/")
.with_header("Allow", "OPTIONS, GET")
.create();
let actual = nu!(format!(r#"http optio... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/mod.rs | crates/nu-command/tests/commands/network/http/mod.rs | use nu_test_support::nu;
use rstest::*;
mod delete;
mod get;
mod head;
mod options;
mod patch;
mod post;
mod put;
#[rstest]
#[case::delete("delete")]
#[case::get("get")]
#[case::head("head")]
#[case::options("options")]
#[case::patch("patch")]
#[case::post("post")]
#[case::put("put")]
#[case::delete_uppercase("DELETE... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/head.rs | crates/nu-command/tests/commands/network/http/head.rs | use mockito::Server;
use nu_test_support::nu;
#[test]
fn http_head_is_success() {
let mut server = Server::new();
let _mock = server.mock("HEAD", "/").with_header("foo", "bar").create();
let actual = nu!(format!(r#"http head {url}"#, url = server.url()));
assert!(actual.out.contains("foo"));
ass... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/post.rs | crates/nu-command/tests/commands/network/http/post.rs | use std::{thread, time::Duration};
use mockito::{Matcher, Server, ServerOpts};
use nu_test_support::nu;
#[test]
fn http_post_is_success() {
let mut server = Server::new();
let _mock = server.mock("POST", "/").match_body("foo").create();
let actual = nu!(format!(r#"http post {url} "foo""#, url = server.u... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/get.rs | crates/nu-command/tests/commands/network/http/get.rs | use std::{thread, time::Duration};
use mockito::Server;
use nu_test_support::nu;
#[test]
fn http_get_is_success() {
let mut server = Server::new();
let _mock = server.mock("GET", "/").with_body("foo").create();
let actual = nu!(format!(r#"http get {url}"#, url = server.url()));
assert_eq!(actual.ou... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/delete.rs | crates/nu-command/tests/commands/network/http/delete.rs | use std::{thread, time::Duration};
use mockito::Server;
use nu_test_support::nu;
#[test]
fn http_delete_is_success() {
let mut server = Server::new();
let _mock = server.mock("DELETE", "/").create();
let actual = nu!(format!(r#"http delete {url}"#, url = server.url()));
assert!(actual.out.is_empty(... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/network/http/patch.rs | crates/nu-command/tests/commands/network/http/patch.rs | use std::{thread, time::Duration};
use mockito::Server;
use nu_test_support::nu;
#[test]
fn http_patch_is_success() {
let mut server = Server::new();
let _mock = server.mock("PATCH", "/").match_body("foo").create();
let actual = nu!(format!(r#"http patch {url} "foo""#, url = server.url()));
assert!... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/database/query_db.rs | crates/nu-command/tests/commands/database/query_db.rs | use nu_test_support::{nu, nu_repl_code, playground::Playground};
// Multiple nu! calls don't persist state, so we can't store it in a function
const DATABASE_INIT: &str = r#"stor open | query db "CREATE TABLE IF NOT EXISTS test_db (
name TEXT,
age INTEGER,
height REAL,
serious BOOLEAN,
created_at D... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/database/mod.rs | crates/nu-command/tests/commands/database/mod.rs | mod into_sqlite;
mod query_db;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/database/into_sqlite.rs | crates/nu-command/tests/commands/database/into_sqlite.rs | use chrono::{DateTime, FixedOffset};
use nu_path::AbsolutePathBuf;
use nu_protocol::{Span, Value, ast::PathMember, casing::Casing, engine::EngineState, record};
use nu_test_support::{
fs::{Stub, line_ending},
nu,
playground::{Dirs, Playground},
};
use rand::{
Rng, SeedableRng,
distr::{Alphanumeric, ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.