Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions compiler/pipec-tests/src/ast/usingstatements/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#[test]
fn test_using_statements() {
{
crate::test_file_generation!("test.pipec",scope scope);
println!("{scope:#?}");
crate::test_file_generation!("singlefile.pipec",scope scope);
assert!(scope.symbols.contains_key("func1"));
assert!(scope.symbols.contains_key("func2"));
assert!(scope.symbols.contains_key("func3"));
Expand All @@ -26,4 +25,29 @@ fn test_using_statements() {
.contains_key("func8")
);
}
{
crate::test_file_generation!("multifile.pipec",scope scope);
assert!(scope.symbols.contains_key("func1"));
assert!(scope.symbols.contains_key("func2"));
assert!(scope.symbols.contains_key("func3"));
assert!(scope.symbols.contains_key("func4"));
assert!(scope.symbols.contains_key("func5"));
assert!(scope.symbols.contains_key("func6"));
assert!(
scope
.submodules
.get("multifilemod")
.unwrap()
.symbols
.contains_key("func7")
);
assert!(
scope
.submodules
.get("multifilemod")
.unwrap()
.symbols
.contains_key("func8")
);
}
}
24 changes: 24 additions & 0 deletions compiler/pipec-tests/src/ast/usingstatements/multifile.pipec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using mod1\(func1,func2);
using mod2\(
mod3\(func3,func4),
mod4\(func5,func6)
);

module mod1 {
function func1() => nothing {}
function func2() => nothing {}
}

module mod2 {
module mod3 {
function func3() => nothing {}
function func4() => nothing {}
}

module mod4 {
function func5() => nothing {}
function func6() => nothing {}
}
}

module multifilemod;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using mod6\(func7,func8);
module mod6 {
function func7() => nothing {}
function func8() => nothing {}
}
function func9() => nothing {}
function func10() => nothing {}