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/src/debug/view_source.rs | crates/nu-command/src/debug/view_source.rs | use nu_engine::command_prelude::*;
use nu_protocol::{Config, PipelineMetadata};
use std::fmt::Write;
#[derive(Clone)]
pub struct ViewSource;
impl Command for ViewSource {
fn name(&self) -> &str {
"view source"
}
fn description(&self) -> &str {
"View a block, module, or a definition."
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/mod.rs | crates/nu-command/src/debug/mod.rs | mod ast;
mod debug_;
mod env;
mod experimental_options;
mod explain;
mod info;
mod inspect;
mod inspect_table;
mod metadata;
mod metadata_access;
mod metadata_set;
mod profile;
mod timeit;
mod util;
mod view;
mod view_blocks;
mod view_files;
mod view_ir;
mod view_source;
mod view_span;
pub use ast::Ast;
pub use debug_... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/metadata_access.rs | crates/nu-command/src/debug/metadata_access.rs | use nu_engine::{command_prelude::*, get_eval_block_with_early_return};
use nu_protocol::{
PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
engine::{Call, Closure, Command, EngineState, Stack},
};
use super::util::build_metadata_record;
#[derive(Clone)]
pub struct MetadataAccess;
impl Command fo... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/metadata_set.rs | crates/nu-command/src/debug/metadata_set.rs | use super::util::{extend_record_with_metadata, parse_metadata_from_record};
use nu_engine::{ClosureEvalOnce, command_prelude::*};
use nu_protocol::{DataSource, engine::Closure};
#[derive(Clone)]
pub struct MetadataSet;
impl Command for MetadataSet {
fn name(&self) -> &str {
"metadata set"
}
fn de... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/metadata.rs | crates/nu-command/src/debug/metadata.rs | use super::util::{build_metadata_record, extend_record_with_metadata};
use nu_engine::command_prelude::*;
use nu_protocol::{
PipelineMetadata,
ast::{Expr, Expression},
};
#[derive(Clone)]
pub struct Metadata;
impl Command for Metadata {
fn name(&self) -> &str {
"metadata"
}
fn description... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/experimental_options.rs | crates/nu-command/src/debug/experimental_options.rs | use nu_engine::command_prelude::*;
use nu_experimental::Status;
#[derive(Clone)]
pub struct DebugExperimentalOptions;
impl Command for DebugExperimentalOptions {
fn name(&self) -> &str {
"debug experimental-options"
}
fn signature(&self) -> Signature {
Signature::build(self.name())
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/view_blocks.rs | crates/nu-command/src/debug/view_blocks.rs | use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct ViewBlocks;
impl Command for ViewBlocks {
fn name(&self) -> &str {
"view blocks"
}
fn description(&self) -> &str {
"View the blocks registered in nushell's EngineState memory."
}
fn extra_description(&self) -> &str {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/inspect.rs | crates/nu-command/src/debug/inspect.rs | use super::inspect_table;
use nu_engine::command_prelude::*;
use nu_utils::terminal_size;
#[derive(Clone)]
pub struct Inspect;
impl Command for Inspect {
fn name(&self) -> &str {
"inspect"
}
fn description(&self) -> &str {
"Inspect pipeline results while running a pipeline."
}
fn... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/src/debug/profile.rs | crates/nu-command/src/debug/profile.rs | use nu_engine::{ClosureEvalOnce, command_prelude::*};
use nu_protocol::{
debugger::{DurationMode, Profiler, ProfilerOptions},
engine::Closure,
};
#[derive(Clone)]
pub struct DebugProfile;
impl Command for DebugProfile {
fn name(&self) -> &str {
"debug profile"
}
fn signature(&self) -> nu_... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/sort_utils.rs | crates/nu-command/tests/sort_utils.rs | use nu_command::{Comparator, sort, sort_by, sort_record};
use nu_protocol::{
Record, Span, Value,
ast::{CellPath, PathMember},
casing::Casing,
record,
};
#[test]
fn test_sort_basic() {
let mut list = vec![
Value::test_string("foo"),
Value::test_int(2),
Value::test_int(3),
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/main.rs | crates/nu-command/tests/main.rs | mod commands;
mod format_conversions;
mod sort_utils;
mod string;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/string/mod.rs | crates/nu-command/tests/string/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/string/format/filesize.rs | crates/nu-command/tests/string/format/filesize.rs | use nu_test_support::nu;
#[test]
fn format_duration() {
let actual = nu!(r#"1MB | format filesize kB"#);
assert_eq!("1000 kB", actual.out);
}
#[test]
fn format_duration_with_invalid_unit() {
let actual = nu!(r#"1MB | format filesize sec"#);
assert!(actual.err.contains("invalid_unit"));
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/string/format/mod.rs | crates/nu-command/tests/string/format/mod.rs | mod duration;
mod filesize;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/string/format/duration.rs | crates/nu-command/tests/string/format/duration.rs | use nu_test_support::nu;
#[test]
fn format_duration() {
let actual = nu!(r#"1hr | format duration sec"#);
assert_eq!("3600 sec", actual.out);
}
#[test]
fn format_duration_with_invalid_unit() {
let actual = nu!(r#"1hr | format duration MB"#);
assert!(actual.err.contains("invalid_unit"));
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/merge.rs | crates/nu-command/tests/commands/merge.rs | use nu_test_support::nu;
#[test]
fn row() {
let left_sample = r#"[[name, country, luck];
[Andrés, Ecuador, 0],
[JT, USA, 0],
[Jason, Canada, 0],
[Yehuda, USA, 0]]"#;
let right_sample = r#"[[name, country, luck];
["Andrés Robalino", "Guayaquil Ecuador", 1],
["J... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/open.rs | crates/nu-command/tests/commands/open.rs | use std::path::PathBuf;
use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use rstest::rstest;
#[test]
fn parses_file_with_uppercase_extension() {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/par_each.rs | crates/nu-command/tests/commands/par_each.rs | use nu_test_support::nu;
#[test]
fn par_each_does_not_flatten_nested_structures() {
// This is a regression test for issue #8497
let actual = nu!("[1 2 3] | par-each { |it| [$it, $it] } | sort | to json --raw");
assert_eq!(actual.out, "[[1,1],[2,2],[3,3]]");
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/complete.rs | crates/nu-command/tests/commands/complete.rs | use nu_test_support::nu;
#[test]
fn basic_stdout() {
let without_complete = nu!(r#"
nu --testbin cococo test
"#);
let with_complete = nu!(r#"
(nu --testbin cococo test | complete).stdout
"#);
assert_eq!(with_complete.out, without_complete.out);
}
#[test]
fn basic_exit_code() {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/debug_info.rs | crates/nu-command/tests/commands/debug_info.rs | use nu_test_support::nu;
#[test]
fn runs_successfully() {
let actual = nu!("debug info");
assert_eq!(actual.err, "");
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/tee.rs | crates/nu-command/tests/commands/tee.rs | use nu_test_support::{fs::file_contents, nu, playground::Playground};
#[test]
fn tee_save_values_to_file() {
Playground::setup("tee_save_values_to_file_test", |dirs, _sandbox| {
let output = nu!(
cwd: dirs.test(),
r#"1..5 | tee { save copy.txt } | to text"#
);
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/slice.rs | crates/nu-command/tests/commands/slice.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn selects_a_row() {
Playground::setup("slice_test_1", |dirs, sandbox| {
sandbox.with_files(&[EmptyFile("notes.txt"), EmptyFile("tests.txt")]);
let actual = nu!(cwd: 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/first.rs | crates/nu-command/tests/commands/first.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn gets_first_rows_by_amount() {
Playground::setup("first_test_1", |dirs, sandbox| {
sandbox.with_files(&[
EmptyFile("los.txt"),
EmptyFile("tres.txt"),
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/ignore.rs | crates/nu-command/tests/commands/ignore.rs | use nu_test_support::nu;
#[test]
fn ignore_still_causes_stream_to_be_consumed_fully() {
let result = nu!("[foo bar] | each { |val| print $val; $val } | ignore");
assert_eq!("foobar", result.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/break_.rs | crates/nu-command/tests/commands/break_.rs | use nu_test_support::nu;
#[test]
fn break_for_loop() {
let actual = nu!("
for i in 1..10 { if $i == 2 { break }; print $i }
");
assert_eq!(actual.out, "1");
}
#[test]
fn break_while_loop() {
let actual = nu!(r#" while true { break }; print "hello" "#);
assert_eq!(actual.out, "hello")... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/where_.rs | crates/nu-command/tests/commands/where_.rs | use nu_test_support::nu;
#[test]
fn filters_by_unit_size_comparison() {
let actual = nu!(
cwd: "tests/fixtures/formats",
"ls | where size > 1kib | sort-by size | get name | first | str trim"
);
assert_eq!(actual.out, "cargo_sample.toml");
}
#[test]
fn filters_with_nothing_comparison() {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/fill.rs | crates/nu-command/tests/commands/fill.rs | use nu_test_support::nu;
#[test]
fn string_fill_plain() {
let actual = nu!(r#""abc" | fill --alignment center --character "+" --width 5"#);
assert_eq!(actual.out, "+abc+");
}
#[test]
fn string_fill_fancy() {
let actual = nu!(r#"
$"(ansi red)a(ansi green)\u{65}\u{308}(ansi cyan)c(ansi reset)"
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/reverse.rs | crates/nu-command/tests/commands/reverse.rs | use nu_test_support::nu;
#[test]
fn can_get_reverse_first() {
let actual = nu!(
cwd: "tests/fixtures/formats",
"ls | sort-by name | reverse | first | get name | str trim "
);
assert_eq!(actual.out, "utf16.ini");
}
#[test]
fn fail_on_non_iterator() {
let actual = nu!("1 | reverse");
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/use_.rs | crates/nu-command/tests/commands/use_.rs | use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn use_module_file_within_block() {
Playground::setup("use_test_1", |dirs, nu| {
let file = dirs.test().join("spam.nu");
nu.with_files(&[FileW... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/match_.rs | crates/nu-command/tests/commands/match_.rs | use nu_test_support::nu;
use nu_test_support::playground::Playground;
use std::fs;
#[test]
fn match_for_range() {
let actual = nu!(r#"match 3 { 1..10 => { print "success" } }"#);
// Make sure we don't see any of these values in the output
// As we do not auto-print loops anymore
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/headers.rs | crates/nu-command/tests/commands/headers.rs | use nu_test_support::nu;
#[test]
fn headers_uses_first_row_as_header() {
let actual = nu!(cwd: "tests/fixtures/formats", "
open sample_headers.xlsx
| get Sheet1
| headers
| get header0
| to json --raw");
assert_eq!(actual.out, r#"["r1c0","r2c0"]"#)
}
#[test]
fn headers... | 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_def.rs | crates/nu-command/tests/commands/export_def.rs | use nu_test_support::nu;
#[test]
fn export_subcommands_help() {
let actual = nu!("export def -h");
assert!(
actual
.out
.contains("Define a custom command and export it from a module")
);
}
#[test]
fn export_should_not_expose_arguments() {
// issue #16211
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/ls.rs | crates/nu-command/tests/commands/ls.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn lists_regular_files() {
Playground::setup("ls_test_1", |dirs, sandbox| {
sandbox.with_files(&[
EmptyFile("yehuda.txt"),
EmptyFile("jttxt"),
EmptyFil... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/select.rs | crates/nu-command/tests/commands/select.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[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/201... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/upsert.rs | crates/nu-command/tests/commands/upsert.rs | use nu_test_support::nu;
#[test]
fn sets_the_column() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open cargo_sample.toml
| upsert dev-dependencies.pretty_assertions "0.7.0"
| get dev-dependencies.pretty_assertions
"#);
assert_eq!(actual.out, "0.7.0");
}
#[test]
fn doesnt... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/run_external.rs | crates/nu-command/tests/commands/run_external.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use rstest::{fixture, rstest};
use rstest_reuse::*;
#[fixture]
#[once]
fn nu_bin() -> String {
nu_test_support::fs::executable_path()
.to_string_lossy()
.to_string()
}
// Template for ru... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/merge_deep.rs | crates/nu-command/tests/commands/merge_deep.rs | use std::fmt::Display;
use nu_test_support::nu;
use rstest::rstest;
struct Strategy<'a>(Option<&'a str>);
impl<'a> Display for Strategy<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0
.map(|s| write!(f, "--strategy={s}"))
.unwrap_or(Ok(()))
}
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/return_.rs | crates/nu-command/tests/commands/return_.rs | use nu_test_support::nu;
#[test]
fn early_return_if_true() {
let actual = nu!("def foo [x] { if true { return 2 }; $x }; foo 100");
assert_eq!(actual.out, r#"2"#);
}
#[test]
fn early_return_if_false() {
let actual = nu!("def foo [x] { if false { return 2 }; $x }; foo 100");
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/utouch.rs | crates/nu-command/tests/commands/utouch.rs | use chrono::{DateTime, Days, Local, TimeDelta, Utc};
use filetime::FileTime;
use nu_test_support::fs::{Stub, files_exist_at};
use nu_test_support::nu;
use nu_test_support::playground::{Dirs, Playground};
use std::path::Path;
// Use 1 instead of 0 because 0 has a special meaning in Windows
const TIME_ONE: FileTime = Fi... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/mut_.rs | crates/nu-command/tests/commands/mut_.rs | use nu_test_support::nu;
use rstest::rstest;
#[test]
fn mut_variable() {
let actual = nu!("mut x = 3; $x = $x + 1; $x");
assert_eq!(actual.out, "4");
}
#[rstest]
#[case("mut in = 3")]
#[case("mut in: int = 3")]
fn mut_name_builtin_var(#[case] assignment: &str) {
assert!(
nu!(assignment)
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/parse.rs | crates/nu-command/tests/commands/parse.rs | use nu_test_support::fs::Stub;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
mod simple {
use super::*;
#[test]
fn extracts_fields_from_the_given_the_pattern() {
Playground::setup("parse_test_simple_1", |dirs, sandbox| {
sandbox.with_files(&[Stub::FileWithConten... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/insert.rs | crates/nu-command/tests/commands/insert.rs | use nu_test_support::nu;
#[test]
fn insert_the_column() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open cargo_sample.toml
| insert dev-dependencies.new_assertions "0.7.0"
| get dev-dependencies.new_assertions
"#);
assert_eq!(actual.out, "0.7.0");
}
#[test]
fn doesnt_con... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/update.rs | crates/nu-command/tests/commands/update.rs | use nu_test_support::nu;
#[test]
fn sets_the_column() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open cargo_sample.toml
| update dev-dependencies.pretty_assertions "0.7.0"
| get dev-dependencies.pretty_assertions
"#);
assert_eq!(actual.out, "0.7.0");
}
#[test]
fn doesnt... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/all.rs | crates/nu-command/tests/commands/all.rs | use nu_test_support::nu;
#[test]
fn checks_all_rows_are_true() {
let actual = nu!(r#"
echo [ "Andrés", "Andrés", "Andrés" ]
| all {|it| $it == "Andrés" }
"#);
assert_eq!(actual.out, "true");
}
#[test]
fn checks_all_rows_are_false_with_param() {
let actual = nu!(" [1, 2, 3, 4] | all {... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/compact.rs | crates/nu-command/tests/commands/compact.rs | use nu_test_support::nu;
#[test]
fn discards_rows_where_given_column_is_empty() {
let sample_json = r#"{
"amigos": [
{"name": "Yehuda", "rusty_luck": 1},
{"name": "JT", "rusty_luck": 1},
{"name": "Andres", "rusty_luck": 1},
{"name":"GorbyPuff"}
]
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/do_.rs | crates/nu-command/tests/commands/do_.rs | use nu_test_support::nu;
#[test]
fn capture_errors_works() {
let actual = nu!("do -c {$env.use}");
eprintln!("actual.err: {:?}", actual.err);
assert!(actual.err.contains("column_not_found"));
}
// TODO: need to add tests under display_error.exit_code = true
#[test]
fn capture_errors_works_for_external()... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/prepend.rs | crates/nu-command/tests/commands/prepend.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn adds_a_row_to_the_beginning() {
Playground::setup("prepend_test_1", |dirs, sandbox| {
sandbox.with_files(&[FileWithContentToBeTrimmed(
"los_tres_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/griddle.rs | crates/nu-command/tests/commands/griddle.rs | use nu_test_support::nu;
#[test]
fn grid_errors_with_few_columns() {
let actual = nu!("[1 2 3 4 5] | grid --width 5");
assert!(actual.err.contains("Couldn't fit grid into 5 columns"));
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/cd.rs | crates/nu-command/tests/commands/cd.rs | use nu_path::Path;
use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn cd_works_with_in_var() {
Playground::setup("cd_test_1", |dirs, _| {
let actual = nu!(
cwd: dirs.root(),
r#"
"cd_test_1" | cd ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/filter.rs | crates/nu-command/tests/commands/filter.rs | use nu_test_support::nu;
#[test]
fn filter_with_return_in_closure() {
let actual = nu!("
1..10 | filter { |it|
if $it mod 2 == 0 {
return true
};
return false;
} | to nuon
");
assert_eq!(actual.out, "[2, 4, 6, 8, 10]");
assert!(actual.err.contains("deprecate... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/split_row.rs | crates/nu-command/tests/commands/split_row.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn to_row() {
Playground::setup("split_row_test_1", |dirs, sandbox| {
sandbox.with_files(&[
FileWithContentToBeTrimmed(
"sample.txt",
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/rm.rs | crates/nu-command/tests/commands/rm.rs | #[cfg(not(windows))]
use nu_path::AbsolutePath;
use nu_test_support::fs::{Stub::EmptyFile, files_exist_at};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use rstest::rstest;
#[cfg(not(windows))]
use std::fs;
#[cfg(windows)]
use std::{fs::OpenOptions, os::windows::fs::OpenOptionsExt};
#[test]
fn... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/ucp.rs | crates/nu-command/tests/commands/ucp.rs | use nu_test_support::fs::file_contents;
use nu_test_support::fs::{
Stub::{EmptyFile, FileWithContent, FileWithPermission},
files_exist_at,
};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use rstest::rstest;
#[cfg(not(target_os = "windows"))]
const PATH_SEPARATOR: &str = "/";
#[cfg(tar... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | true |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/sort.rs | crates/nu-command/tests/commands/sort.rs | use nu_test_support::nu;
#[test]
fn by_invalid_types() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open cargo_sample.toml --raw
| echo ["foo" 1]
| sort
| to json -r
"#);
let json_output = r#"[1,"foo"]"#;
assert_eq!(actual.out, json_output);
}
#[test]
fn sort_... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/rename.rs | crates/nu-command/tests/commands/rename.rs | use nu_test_support::nu;
#[test]
fn changes_the_column_name() {
let sample = r#"[
["Andrés N. Robalino"],
["JT Turner"],
["Yehuda Katz"],
["Jason Gedge"]
]"#;
let actual = nu!(format!(
"
{sample}
| wrap name
| rename mosqueteros
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/with_env.rs | crates/nu-command/tests/commands/with_env.rs | use nu_test_support::nu;
#[test]
fn with_env_extends_environment() {
let actual = nu!("with-env { FOO: BARRRR } {echo $env} | get FOO");
assert_eq!(actual.out, "BARRRR");
}
#[test]
fn with_env_shorthand() {
let actual = nu!("FOO=BARRRR echo $env | get FOO");
assert_eq!(actual.out, "BARRRR");
}
#[te... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/empty.rs | crates/nu-command/tests/commands/empty.rs | use nu_test_support::nu;
#[test]
fn reports_emptiness() {
let actual = nu!(r#"
[[] '' {} null]
| all {||
is-empty
}
"#);
assert_eq!(actual.out, "true");
}
#[test]
fn reports_nonemptiness() {
let actual = nu!(r#"
[[1] ' ' {a:1} 0]
| any {||
i... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/chunks.rs | crates/nu-command/tests/commands/chunks.rs | use nu_test_support::nu;
#[test]
fn chunk_size_negative() {
let actual = nu!("[0 1 2] | chunks -1");
assert!(actual.err.contains("positive"));
}
#[test]
fn chunk_size_zero() {
let actual = nu!("[0 1 2] | chunks 0");
assert!(actual.err.contains("zero"));
}
#[test]
fn chunk_size_not_int() {
let 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/config_env_default.rs | crates/nu-command/tests/commands/config_env_default.rs | use nu_test_support::nu;
#[test]
fn print_config_env_default_to_stdout() {
let actual = nu!("config env --default");
assert_eq!(
actual.out,
nu_utils::ConfigFileKind::Env
.default()
.replace(['\n', '\r'], "")
);
assert!(actual.err.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/try_.rs | crates/nu-command/tests/commands/try_.rs | use nu_test_support::nu;
#[test]
fn try_succeed() {
let output = nu!("try { 345 } catch { echo 'hello' }");
assert!(output.out.contains("345"));
}
#[test]
fn try_catch() {
let output = nu!("try { foobarbaz } catch { echo 'hello' }");
assert!(output.out.contains("hello"));
}
#[test]
fn catch_can_acc... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/help.rs | crates/nu-command/tests/commands/help.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code};
// Note: These tests might slightly overlap with tests/scope/mod.rs
#[test]
fn help_commands_length() {
let actual = nu!("help commands | length");
let output = 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/flatten.rs | crates/nu-command/tests/commands/flatten.rs | use nu_test_support::nu;
#[test]
fn flatten_nested_tables_with_columns() {
let actual = nu!(r#"
[
[[origin, people]; [Ecuador, ('Andres' | wrap name)]]
[[origin, people]; [Nu, ('nuno' | wrap name)]]
]
| flatten --all
| flatten --all
| get name
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/redirection.rs | crates/nu-command/tests/commands/redirection.rs | use nu_test_support::fs::{Stub::FileWithContent, file_contents};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn redirect_err() {
Playground::setup("redirect_err_test", |dirs, _sandbox| {
let output = nu!(
cwd: dirs.test(),
r#"$env.BAZ = "asdfasdfasd... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/interleave.rs | crates/nu-command/tests/commands/interleave.rs | use nu_test_support::nu;
#[test]
fn interleave_external_commands() {
let result = nu!("interleave \
{ nu -n -c 'print hello; print world' | lines | each { 'greeter: ' ++ $in } } \
{ nu -n -c 'print nushell; print rocks' | lines | each { 'evangelist: ' ++ $in } } | \
each { print }; null");
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/table.rs | crates/nu-command/tests/commands/table.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code};
#[test]
fn table_0() {
let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 3]]] | table --width=80");
assert_eq!(
actual.out,
"╭───┬───┬───┬────────────────╮\
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | true |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/error_make.rs | crates/nu-command/tests/commands/error_make.rs | use nu_test_support::nu;
// Required columns present
#[test]
fn error_make_empty() {
let actual = nu!("error make {}");
assert!(actual.err.contains("Cannot find column 'msg'"));
}
#[test]
fn error_make_no_label_text() {
let actual = nu!("error make {msg:no_label_text,label:{span:{start:1,end:1}}}");
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/last.rs | crates/nu-command/tests/commands/last.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn gets_the_last_row() {
let actual = nu!(
cwd: "tests/fixtures/formats",
"ls | sort-by name | last 1 | get name.0 | str trim"
);
assert_eq!(actual.out, "utf16.ini");
}
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/glob.rs | crates/nu-command/tests/commands/glob.rs | use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use rstest::rstest;
use std::path::{Path, PathBuf};
#[test]
fn empty_glob_pattern_triggers_error() {
Playground::setup("glob_test_1", |dirs, sandbox| {
sandbox.with_files(&[
EmptyFile... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/default.rs | crates/nu-command/tests/commands/default.rs | use nu_test_support::{fs::Stub::EmptyFile, nu, playground::Playground};
#[test]
fn adds_row_data_if_column_missing() {
let sample = r#"{
"amigos": [
{"name": "Yehuda"},
{"name": "JT", "rusty_luck": 0},
{"name": "Andres", "rusty_luck": 0},
{"name": "Michael", ... | 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_char.rs | crates/nu-command/tests/commands/seq_char.rs | use nu_test_support::nu;
#[test]
fn fails_when_first_arg_is_multiple_chars() {
let actual = nu!("seq char aa z");
assert!(
actual
.err
.contains("input should be a single ASCII character")
);
}
#[test]
fn fails_when_second_arg_is_multiple_chars() {
let actual = nu!("se... | 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_datetime.rs | crates/nu-command/tests/commands/into_datetime.rs | use nu_test_support::nu;
// Tests happy paths
#[test]
fn into_datetime_from_record_cell_path() {
let actual = nu!(r#"{d: '2021'} | into datetime d"#);
assert!(actual.out.contains("years ago"));
}
#[test]
fn into_datetime_from_record() {
let actual = nu!(
r#"{year: 2023, month: 1, day: 2, hour: 3... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/find.rs | crates/nu-command/tests/commands/find.rs | use nu_test_support::nu;
#[test]
fn find_with_list_search_with_string() {
let actual = nu!("[moe larry curly] | find moe | get 0");
let actual_no_highlight = nu!("[moe larry curly] | find --no-highlight moe | get 0");
assert_eq!(
actual.out,
"\u{1b}[39m\u{1b}[0m\u{1b}[41;39mmoe\u{1b}[0m\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/which.rs | crates/nu-command/tests/commands/which.rs | use nu_test_support::nu;
#[test]
fn which_ls() {
let actual = nu!("which ls | get type.0");
assert_eq!(actual.out, "built-in");
}
#[ignore = "TODO: Can't have alias recursion"]
#[test]
fn which_alias_ls() {
let actual = nu!("alias ls = ls -a; which ls | get path.0 | str trim");
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/uname.rs | crates/nu-command/tests/commands/uname.rs | use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn test_uname_all() {
Playground::setup("uname_test_1", |dirs, _| {
let actual = nu!(
cwd: dirs.test(),
"uname"
);
assert!(actual.status.success())
})
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/split_column.rs | crates/nu-command/tests/commands/split_column.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn to_column() {
Playground::setup("split_column_test_1", |dirs, sandbox| {
sandbox.with_files(&[
FileWithContentToBeTrimmed(
"sample.txt",
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/echo.rs | crates/nu-command/tests/commands/echo.rs | use nu_test_support::nu;
#[test]
fn echo_range_is_lazy() {
let actual = nu!("echo 1..10000000000 | first 3 | to json --raw");
assert_eq!(actual.out, "[1,2,3]");
}
#[test]
fn echo_range_handles_inclusive() {
let actual = nu!("echo 1..3 | each { |x| $x } | to json --raw");
assert_eq!(actual.out, "[1,2... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/umkdir.rs | crates/nu-command/tests/commands/umkdir.rs | use nu_test_support::fs::files_exist_at;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[cfg(not(windows))]
use uucore::mode;
#[test]
fn creates_directory() {
Playground::setup("mkdir_test_1", |dirs, _| {
nu!(
cwd: dirs.test(),
"mkdir my_new_directory"
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/cal.rs | crates/nu-command/tests/commands/cal.rs | use nu_test_support::nu;
// Tests against table/structured data
#[test]
fn cal_full_year() {
let actual = nu!("cal -t -y --full-year 2010 | first | to json -r");
let first_week_2010_json =
r#"{"year":2010,"su":null,"mo":null,"tu":null,"we":null,"th":null,"fr":1,"sa":2}"#;
assert_eq!(actual.out, 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/reduce.rs | crates/nu-command/tests/commands/reduce.rs | use nu_test_support::nu;
#[test]
fn reduce_table_column() {
let actual = nu!(r#"
echo "[{month:2,total:30}, {month:3,total:10}, {month:4,total:3}, {month:5,total:60}]"
| from json
| get total
| reduce --fold 20 { |it, acc| $it + $acc ** 1.05}
| into string -d 1
"#);
assert_eq!(actual.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/uniq_by.rs | crates/nu-command/tests/commands/uniq_by.rs | use nu_test_support::nu;
#[test]
fn removes_duplicate_rows() {
let sample = r#"[
[first_name , last_name, rusty_at, type];
[Andrés , Robalino, "10/11/2013", A],
[Afonso , Turner, "10/12/2013", B],
[Yehuda , Katz, "10/11/2013", A],
[JT , Turner, "11/12/201... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/stor.rs | crates/nu-command/tests/commands/stor.rs | use nu_test_support::nu;
#[test]
fn stor_insert() {
let actual = nu!(r#"
stor create --table-name test_table --columns { id: int, value: str };
stor insert -t test_table --data-record {
id: 1
value: "'Initial value'"
};
stor open | query db 'select value from... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/let_.rs | crates/nu-command/tests/commands/let_.rs | use nu_test_support::nu;
use rstest::rstest;
#[rstest]
#[case("let in = 3")]
#[case("let in: int = 3")]
fn let_name_builtin_var(#[case] assignment: &str) {
assert!(
nu!(assignment)
.err
.contains("'in' is the name of a builtin Nushell variable")
);
}
#[test]
fn let_doesnt_mutat... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/uniq.rs | crates/nu-command/tests/commands/uniq.rs | use nu_test_support::nu;
const SAMPLE_CSV_CONTENT: &str = 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],
[JT, Turner, "10/12/2013", B],
[Yehuda, Ka... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/terminal.rs | crates/nu-command/tests/commands/terminal.rs | use nu_test_support::nu;
// Inside nu! stdout is piped so it won't be a terminal
#[test]
fn is_terminal_stdout_piped() {
let actual = nu!(r#"
is-terminal --stdout
"#);
assert_eq!(actual.out, "false");
}
#[test]
fn is_terminal_two_streams() {
let actual = nu!(r#"
is-terminal --stdin --... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/chunk_by.rs | crates/nu-command/tests/commands/chunk_by.rs | use nu_test_support::nu;
#[test]
fn chunk_by_on_empty_input_returns_empty_list() {
let actual = nu!("[] | chunk-by {|it| $it} | to nuon");
assert!(actual.err.is_empty());
assert_eq!(actual.out, "[]");
}
#[test]
fn chunk_by_strings_works() {
let sample = r#"[a a a b b b c c c a a a]"#;
let 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/any.rs | crates/nu-command/tests/commands/any.rs | use nu_test_support::nu;
#[test]
fn checks_any_row_is_true() {
let actual = nu!(r#"
echo [ "Ecuador", "USA", "New Zealand" ]
| any {|it| $it == "New Zealand" }
"#);
assert_eq!(actual.out, "true");
}
#[test]
fn checks_any_column_of_a_table_is_true() {
let actual = nu!("
echo [... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/transpose.rs | crates/nu-command/tests/commands/transpose.rs | use nu_test_support::nu;
#[test]
fn row() {
let actual = nu!("[[key value]; [foo 1] [foo 2]] | transpose -r | debug");
assert!(actual.out.contains("foo: 1"));
}
#[test]
fn row_but_last() {
let actual = nu!("[[key value]; [foo 1] [foo 2]] | transpose -r -l | debug");
assert!(actual.out.contains("foo:... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/while_.rs | crates/nu-command/tests/commands/while_.rs | use nu_test_support::nu;
#[test]
fn while_sum() {
let actual = nu!(
"mut total = 0; mut x = 0; while $x <= 10 { $total = $total + $x; $x = $x + 1 }; $total"
);
assert_eq!(actual.out, "55");
}
#[test]
fn while_doesnt_auto_print_in_each_iteration() {
let actual = nu!("mut total = 0; while $tota... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/mod.rs | crates/nu-command/tests/commands/mod.rs | mod alias;
mod all;
mod any;
mod append;
mod assignment;
mod base;
mod break_;
mod bytes;
mod cal;
mod cd;
mod chunk_by;
mod chunks;
mod compact;
mod complete;
mod config_env_default;
mod config_nu_default;
mod continue_;
mod conversions;
#[cfg(feature = "sqlite")]
mod database;
mod date;
mod debug_info;
mod def;
mod 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/config_nu_default.rs | crates/nu-command/tests/commands/config_nu_default.rs | use nu_test_support::nu;
#[test]
fn print_config_nu_default_to_stdout() {
let actual = nu!("config nu --default");
assert_eq!(
actual.out,
nu_utils::ConfigFileKind::Config
.default()
.replace(['\n', '\r'], "")
);
assert!(actual.err.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/drop.rs | crates/nu-command/tests/commands/drop.rs | use nu_test_support::nu;
#[test]
fn columns() {
let actual = nu!("
echo [
[arepas, color];
[3, white]
[8, yellow]
[4, white]
] | drop column | columns | length
");
assert_eq!(actual.out, "1");
}
#[test]
fn drop_columns_positive_value() {
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/format.rs | crates/nu-command/tests/commands/format.rs | use nu_test_support::fs::Stub::{EmptyFile, FileWithContentToBeTrimmed};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn creates_the_resulting_string_from_the_given_fields() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
open cargo_sample.toml
| get package
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/append.rs | crates/nu-command/tests/commands/append.rs | use nu_test_support::nu;
#[test]
fn adds_a_row_to_the_end() {
let actual = nu!(r#"
echo [ "Andrés N. Robalino", "JT Turner", "Yehuda Katz" ]
| append "pollo loco"
| get 3
"#);
assert_eq!(actual.out, "pollo loco");
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/join.rs | crates/nu-command/tests/commands/join.rs | use nu_test_support::nu;
#[test]
fn cases_where_result_is_same_between_join_types_inner() {
do_cases_where_result_is_same_between_join_types("--inner")
}
#[test]
fn cases_where_result_differs_between_join_types_inner() {
do_cases_where_result_differs_between_join_types("--inner")
}
#[test]
fn cases_where_res... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/alias.rs | crates/nu-command/tests/commands/alias.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[ignore = "TODO?: Aliasing parser keywords does not work anymore"]
#[test]
fn alias_simple() {
let actual = nu!(cwd: "tests/fixtures/formats", r#"
alias bar = use sample_def.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/def.rs | crates/nu-command/tests/commands/def.rs | use nu_test_support::nu;
use nu_test_support::playground::Playground;
use std::fs;
#[test]
fn def_with_trailing_comma() {
let actual = nu!("def test-command [ foo: int, ] { $foo }; test-command 1");
assert!(actual.out == "1");
}
#[test]
fn def_with_comment() {
Playground::setup("def_with_comment", |dirs,... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/semicolon.rs | crates/nu-command/tests/commands/semicolon.rs | use nu_test_support::nu;
use nu_test_support::playground::Playground;
#[test]
fn semicolon_allows_lhs_to_complete() {
Playground::setup("create_test_1", |dirs, _sandbox| {
let actual = nu!(
cwd: dirs.test(),
"touch i_will_be_created_semi.txt; echo done"
);
let 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/window.rs | crates/nu-command/tests/commands/window.rs | use nu_test_support::nu;
#[test]
fn window_size_negative() {
let actual = nu!("[0 1 2] | window -1");
assert!(actual.err.contains("positive"));
}
#[test]
fn window_size_zero() {
let actual = nu!("[0 1 2] | window 0");
assert!(actual.err.contains("zero"));
}
#[test]
fn window_size_not_int() {
let ... | 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_int.rs | crates/nu-command/tests/commands/into_int.rs | use chrono::{DateTime, FixedOffset, NaiveDate, TimeZone};
use rstest::rstest;
use nu_test_support::nu;
#[test]
fn into_int_filesize() {
let actual = nu!("echo 1kb | into int | each { |it| $it / 1000 }");
assert!(actual.out.contains('1'));
}
#[test]
fn into_int_filesize2() {
let actual = nu!("echo 1kib |... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-command/tests/commands/rotate.rs | crates/nu-command/tests/commands/rotate.rs | use nu_test_support::nu;
#[test]
fn counter_clockwise() {
let table = r#"[
[col1, col2, EXPECTED];
[---, "|||", XX1]
[---, "|||", XX2]
[---, "|||", XX3]
]"#;
let expected = nu!(r#"
[
[ column0, column1, column2, column3];
... | 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.