Changeset - 8e72ec01be84
[Not reviewed]
0 1 0
mh - 4 years ago 2021-12-15 08:26:02
contact@maxhenger.nl
Add test for incorrect tuple member type
1 file changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/protocol/tests/parser_validation.rs
Show inline comments
 
@@ -404,12 +404,25 @@ fn test_correct_tuple_members() {
 
        .for_field("bar", |f| { f.assert_parser_type("(u8,u16,u32)"); })
 
        .for_field("baz", |f| { f.assert_parser_type("(s8,s16,s32)"); })
 
        .assert_size_alignment("Foo", 16, 4);
 
    });
 
}
 

	
 
#[test]
 
fn test_incorrect_tuple_member() {
 
    // Test not really necessary, but hey, what's a test between friends
 
    Tester::new_single_source_expect_err(
 
        "unknown tuple member",
 
        "struct Foo{ (u32, u32, u32, YouThirstySchmoo) field }"
 
    ).error(|e| { e
 
        .assert_num(1)
 
        .assert_msg_has(0, "unknown type")
 
        .assert_occurs_at(0, "YouThirstySchmoo");
 
    });
 
}
 

	
 
#[test]
 
fn test_correct_tuple_polymorph_args() {
 
    Tester::new_single_source_expect_ok(
 
        "single tuple arg",
 
        "
 
        union Option<T>{ Some(T), None }
0 comments (0 inline, 0 general)