mirror of
https://github.com/nushell/nushell.git
synced 2025-06-19 00:17:02 +02:00
Minimal std exports
This commit is contained in:
parent
d2b3556914
commit
f691c71ebe
@ -1,18 +1,9 @@
|
|||||||
# std.nu, `used` to load all standard library components
|
# std.nu, `used` to load base standard library components
|
||||||
|
|
||||||
#export module assert
|
|
||||||
#export module bench
|
|
||||||
#export module dirs
|
|
||||||
#export module dt
|
|
||||||
#export module formats
|
|
||||||
#export module help
|
|
||||||
export module input
|
export module input
|
||||||
export module iter
|
export module iter
|
||||||
#export module log
|
|
||||||
#export module math
|
|
||||||
#export module xml
|
|
||||||
|
|
||||||
# Make commands available in the top-level module
|
# Make certain commands available in the top-level namespace
|
||||||
export use lib *
|
export use lib *
|
||||||
export use formats *
|
export use formats *
|
||||||
export use dt *
|
export use dt *
|
@ -1,4 +1,8 @@
|
|||||||
use std/log
|
use std/log
|
||||||
|
export-env {
|
||||||
|
# Place NU_FORMAT... environment variables in module-scope
|
||||||
|
export use std/log *
|
||||||
|
}
|
||||||
|
|
||||||
def "nu-complete threads" [] {
|
def "nu-complete threads" [] {
|
||||||
seq 1 (sys cpu | length)
|
seq 1 (sys cpu | length)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use std *
|
|
||||||
use std/assert
|
use std/assert
|
||||||
|
|
||||||
def run [
|
def run [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std *
|
|
||||||
use std/assert
|
use std/assert
|
||||||
|
use std/log
|
||||||
use std/log *
|
use std/log *
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
use std/assert
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
def std_pre_import [] {
|
|
||||||
# These commands shouldn't exist without an import
|
|
||||||
assert length (scope commands | where name == "path add") 0
|
|
||||||
assert length (scope commands | where name == "ellie") 0
|
|
||||||
assert length (scope commands | where name == "repeat") 0
|
|
||||||
assert length (scope commands | where name == "from jsonl") 0
|
|
||||||
assert length (scope commands | where name == "datetime-diff") 0
|
|
||||||
}
|
|
||||||
|
|
||||||
def std_post_import [] {
|
|
||||||
# After importing std, these commands should be
|
|
||||||
# available at the top level namespace
|
|
||||||
use std *
|
|
||||||
assert length (scope commands | where name == "path add") 1
|
|
||||||
assert length (scope commands | where name == "ellie") 1
|
|
||||||
assert length (scope commands | where name == "repeat") 1
|
|
||||||
assert length (scope commands | where name == "from jsonl") 1
|
|
||||||
assert length (scope commands | where name == "datetime-diff") 1
|
|
||||||
}
|
|
11
crates/nu-std/tests/test_std_postload.nu
Normal file
11
crates/nu-std/tests/test_std_postload.nu
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
use std/assert
|
||||||
|
export use std *
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
def std_post_import [] {
|
||||||
|
assert length (scope commands | where name == "path add") 1
|
||||||
|
assert length (scope commands | where name == "ellie") 1
|
||||||
|
assert length (scope commands | where name == "repeat") 1
|
||||||
|
assert length (scope commands | where name == "from jsonl") 1
|
||||||
|
assert length (scope commands | where name == "datetime-diff") 1
|
||||||
|
}
|
11
crates/nu-std/tests/test_std_preload.nu
Normal file
11
crates/nu-std/tests/test_std_preload.nu
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
use std/assert
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
def std_pre_import [] {
|
||||||
|
# These commands shouldn't exist without an import
|
||||||
|
assert length (scope commands | where name == "path add") 0
|
||||||
|
assert length (scope commands | where name == "ellie") 0
|
||||||
|
assert length (scope commands | where name == "repeat") 0
|
||||||
|
assert length (scope commands | where name == "from jsonl") 0
|
||||||
|
assert length (scope commands | where name == "datetime-diff") 0
|
||||||
|
}
|
@ -7,5 +7,8 @@ fn not_loaded() -> TestResult {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn use_command() -> TestResult {
|
fn use_command() -> TestResult {
|
||||||
run_test_std("use ([ std, assert ] | path join); assert true; print 'it works'", "it works")
|
run_test_std(
|
||||||
|
"use ([ std, assert ] | path join); assert true; print 'it works'",
|
||||||
|
"it works",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user