mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 17:25:15 +02:00
Add support for module imports
This commit is contained in:
32
src/tests.rs
32
src/tests.rs
@ -342,3 +342,35 @@ fn better_block_types() -> TestResult {
|
||||
"1 is 2",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_imports_1() -> TestResult {
|
||||
run_test(
|
||||
r#"module foo { def a [] { 1 }; def b [] { 2 } }; use foo; foo.a"#,
|
||||
"1",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_imports_2() -> TestResult {
|
||||
run_test(
|
||||
r#"module foo { def a [] { 1 }; def b [] { 2 } }; use foo.a; a"#,
|
||||
"1",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_imports_3() -> TestResult {
|
||||
run_test(
|
||||
r#"module foo { def a [] { 1 }; def b [] { 2 } }; use foo.*; b"#,
|
||||
"2",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_imports_4() -> TestResult {
|
||||
fail_test(
|
||||
r#"module foo { def a [] { 1 }; def b [] { 2 } }; use foo.c"#,
|
||||
"not find import",
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user