Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: verify fix for #1377 #1437

Merged
merged 1 commit into from
Aug 7, 2024
Merged
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
57 changes: 57 additions & 0 deletions assembly/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2486,3 +2486,60 @@ fn test_compiled_library() {

let _program = assembler.assemble_program(program_source).unwrap();
}

#[test]
fn test_reexported_proc_with_same_name_as_local_proc_diff_locals() {
let context = TestContext::new();
let mut mod_parser = ModuleParser::new(ModuleKind::Library);
let mod1 = {
let source = source_file!(
&context,
"export.foo.2
push.1
drop
end
"
bobbinth marked this conversation as resolved.
Show resolved Hide resolved
);
mod_parser.parse(LibraryPath::new("test::mod1").unwrap(), source).unwrap()
};

let mod2 = {
let source = source_file!(
&context,
"use.test::mod1
export.foo
exec.mod1::foo
end
"
bobbinth marked this conversation as resolved.
Show resolved Hide resolved
);
mod_parser.parse(LibraryPath::new("test::mod2").unwrap(), source).unwrap()
};

let compiled_library = {
let assembler = Assembler::new(context.source_manager());
assembler.assemble_library([mod1, mod2]).unwrap()
};

assert_eq!(compiled_library.exports().count(), 2);

// Compile program that uses compiled library
let mut assembler = Assembler::new(context.source_manager());

assembler.add_library(&compiled_library).unwrap();

let program_source = "
use.test::mod1
use.test::mod2

proc.foo.1
exec.mod1::foo
exec.mod2::foo
end

begin
exec.foo
end
";

let _program = assembler.assemble_program(program_source).unwrap();
}
Loading