diff --git a/src/protocol/tests/parser_validation.rs b/src/protocol/tests/parser_validation.rs new file mode 100644 index 0000000000000000000000000000000000000000..741203c921e0b370a23cc3cb94ebd22a5f41cd31 --- /dev/null +++ b/src/protocol/tests/parser_validation.rs @@ -0,0 +1,33 @@ +/// parser_validation.rs +/// +/// Simple tests for the validation phase +/// TODO: If semicolon behind struct definition: should be fine... + +use super::*; + +#[test] +fn test_correct_struct_instance() { + Tester::new_single_source_expect_ok( + "single field", + " + struct Foo { int a } + Foo bar(int arg) { return Foo{ a: arg }; } + " + ); + + Tester::new_single_source_expect_ok( + "multiple fields", + " + struct Foo { int a, int b } + Foo bar(int arg) { return Foo{ a: arg, b: arg }; } + " + ); + + Tester::new_single_source_expect_ok( + "single field, explicit polymorph", + " + struct Foo{ T field } + Foo bar(int arg) { return Foo{ field: arg }; } + " + ); +} \ No newline at end of file