use super::*;
#[test]
fn must_be_object_name() {
let mut builder = LibraryBuilder::new();
let code = builder.code(
"libname",
"
package pkg is
end package;
package body pkg is
procedure proc(signal good : in bit) is
begin
wait on good;
wait on proc;
end;
end package body;
",
);
let (_, diagnostics) = builder.get_analyzed_root();
check_diagnostics(
diagnostics,
vec![Diagnostic::error(
code.s1("wait on proc").s1("proc"),
"proc[BIT] is not a signal and cannot be in a sensitivity list",
)],
)
}
#[test]
fn must_be_signal_name() {
let mut builder = LibraryBuilder::new();
let code = builder.code(
"libname",
"
package pkg is
end package;
package body pkg is
constant c0 : bit := '0';
procedure proc(signal good : in bit) is
begin
wait on good;
wait on c0;
end;
end package body;
",
);
let (_, diagnostics) = builder.get_analyzed_root();
check_diagnostics(
diagnostics,
vec![Diagnostic::error(
code.s1("wait on c0").s1("c0"),
"constant 'c0' is not a signal and cannot be in a sensitivity list",
)],
)
}
#[test]
fn must_not_be_output() {
let mut builder = LibraryBuilder::new();
let code = builder.code(
"libname",
"
package pkg is
end package;
package body pkg is
procedure proc(signal bad : out bit) is
begin
wait on bad;
end;
end package body;
",
);
let (_, diagnostics) = builder.get_analyzed_root();
check_diagnostics(
diagnostics,
vec![Diagnostic::error(
code.s1("wait on bad").s1("bad"),
"interface signal 'bad' of mode out cannot be in a sensitivity list",
)],
)
}