Add support for module imports

This commit is contained in:
JT
2021-09-27 07:39:19 +13:00
parent 47421e9ca7
commit abb0d7bd22
11 changed files with 630 additions and 469 deletions

View File

@ -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",
)
}