diff --git a/schala-lang/language/src/symbol_table/test.rs b/schala-lang/language/src/symbol_table/test.rs index 11c2d2d..d6188e0 100644 --- a/schala-lang/language/src/symbol_table/test.rs +++ b/schala-lang/language/src/symbol_table/test.rs @@ -14,10 +14,10 @@ fn add_symbols_from_source(src: &str) -> (SymbolTable, Result<(), String>) { } macro_rules! values_in_table { - ($source:literal, $single_value:expr) => { - values_in_table!($source | $single_value); + ($source:expr, $single_value:expr) => { + values_in_table!($source => $single_value); }; - ($source:literal | $( $value:expr ),* ) => { + ($source:expr => $( $value:expr ),* ) => { { let (symbol_table, _) = add_symbols_from_source($source); $( @@ -33,7 +33,7 @@ macro_rules! values_in_table { #[test] fn basic_symbol_table() { values_in_table! { "let a = 10; fn b() { 20 }", &fqsn!("b"; tr) }; - values_in_table! { "type Option = Some(T) | None" | + values_in_table! { "type Option = Some(T) | None" => &fqsn!("Option"; tr), &fqsn!("Option"; ty, "Some"; tr), &fqsn!("Option"; ty, "None"; tr) }; @@ -155,6 +155,22 @@ inner_func(x) assert!(output.unwrap_err().contains("Duplicate")) } +#[test] +fn modules() { + let source = r#" +module stuff { + fn item() { + } +} + +fn item() +"#; + values_in_table! { source => + &fqsn!("item"; tr), + &fqsn!("stuff"; tr, "item"; tr) + }; +} + #[test] fn duplicate_modules() { let source = r#"