From 58dcb2dbf4bf927cb44d024e7b0dab2847d986fc Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 21 Jul 2024 18:24:15 +0200 Subject: [PATCH] Improve corpus tests --- corpus/declarations.sk | 12 ++++++++++++ corpus/types.sk | 16 ++++++++++++++++ src/test/mod.rs | 9 +++++++++ 3 files changed, 37 insertions(+) create mode 100644 corpus/declarations.sk diff --git a/corpus/declarations.sk b/corpus/declarations.sk new file mode 100644 index 0000000..989860e --- /dev/null +++ b/corpus/declarations.sk @@ -0,0 +1,12 @@ +let add2 a = a + 2 + +let multi_add2 l = { + let items = items l + add_all items 2 +} + +let basic_value = 10 + +let calculation = (1 * 1) + (2 * (2 + 3)) + +let calculation_with_fn fn = 1 * fn (2 * 2) diff --git a/corpus/types.sk b/corpus/types.sk index ec7b900..e0552ff 100644 --- a/corpus/types.sk +++ b/corpus/types.sk @@ -22,3 +22,19 @@ type ShoppingList = #{ utils: Utils packaging: Packaging } + +type NestedHell = #[ + NoNesting Num + Nesting #[ + FirstLevel #[ + SecondLevel #[ + Third Lvl + ] + Second #{ + first: Num + second: Num + } + ] + StillFirst Num + ] +] diff --git a/src/test/mod.rs b/src/test/mod.rs index f6c6b58..b4dfdfa 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -13,3 +13,12 @@ fn it_parse_types() { panic!("{e}") } } + +#[test] +fn it_parse_declarations() { + let result = parse(include_str!("../../corpus/declarations.sk")); + + if let Err(e) = result { + panic!("{e}") + } +}