diff --git a/src/parser.rs b/src/parser.rs index 9207d38..ccbe4e6 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -164,11 +164,6 @@ mod test { use super::*; use nom::combinator::all_consuming; - #[test] - fn test_decl() { - declaration("reg abcd".into()).unwrap(); - } - #[test] fn test_operation() { operation(" a | b ".into()).unwrap(); diff --git a/src/parser/module.rs b/src/parser/module.rs index fe1e676..91425de 100644 --- a/src/parser/module.rs +++ b/src/parser/module.rs @@ -73,7 +73,7 @@ fn assign_item(input: Span) -> IResult { fn module_item(input: Span) -> IResult { alt(( - map(assign_statement, ModuleItem::Assign), + map(assign_item, ModuleItem::Assign), map(proc_block, ModuleItem::Proc), ))(input) } @@ -97,3 +97,27 @@ pub fn module(input: Span) -> IResult { ), )(input) } + +#[cfg(test)] +mod test { + use super::*; + use nom::combinator::all_consuming; + + #[test] + fn test_decl() { + declaration("reg abcd".into()).unwrap(); + } + + #[test] + fn test_assignment_item() { + all_consuming(assign_item)(" assign a = b ; ".into()).unwrap(); + all_consuming(assign_item)(" assign a = b | c ; ".into()).unwrap(); + } + + #[test] + fn test_module_item() { + all_consuming(module_item)(" assign a = b ;".into()).unwrap(); + } +} + +