diff --git a/schala-lang/language/src/symbol_table/test.rs b/schala-lang/language/src/symbol_table/test.rs index 999218b..a620e2f 100644 --- a/schala-lang/language/src/symbol_table/test.rs +++ b/schala-lang/language/src/symbol_table/test.rs @@ -5,24 +5,31 @@ use super::*; use crate::util::quick_ast; macro_rules! values_in_table { - //TODO multiple values - ($source:expr, $single_value:expr) => { + ($source:literal, $single_value:expr) => { + values_in_table!($source | $single_value); + }; + ($source:literal | $( $value:expr ),* ) => { { let mut symbol_table = SymbolTable::new(); let ast = quick_ast($source); symbol_table.add_top_level_symbols(&ast).unwrap(); - match symbol_table.lookup_by_fqsn($single_value) { - Some(_spec) => (), - None => panic!(), - }; + $( + match symbol_table.lookup_by_fqsn($value) { + Some(_spec) => (), + None => panic!(), + }; + )* } - } + }; } #[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", &fqsn!("Option"; tr) }; + values_in_table! { "type Option = Some(T) | None" | + &fqsn!("Option"; tr), + &fqsn!("Option"; ty, "Some"; tr), + &fqsn!("Option"; ty, "None"; tr) }; } #[test]