Changeset - 863da17c9dc3
[Not reviewed]
0 1 0
MH - 3 years ago 2022-02-08 15:17:28
contact@maxhenger.nl
Add some tests for goto/select interaction
1 file changed with 29 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/protocol/tests/parser_validation.rs
Show inline comments
 
@@ -734,7 +734,35 @@ fn test_incorrect_goto_statement() {
 
        .assert_occurs_at(0, "goto exit;").assert_msg_has(0, "not escape the surrounding sync")
 
        .assert_occurs_at(1, "exit: u32 v").assert_msg_has(1, "target of the goto")
 
        .assert_occurs_at(2, "sync {").assert_msg_has(2, "jump past this");
 
    })
 
    });
 

	
 
    Tester::new_single_source_expect_err(
 
        "goto jumping to select case",
 
        "primitive f(in<u32> i) {
 
            sync select {
 
                hello: auto a = get(i) -> i += 1
 
            }
 
            goto hello;
 
        }"
 
    ).error(|e| { e
 
        .assert_msg_has(0, "expected '->'");
 
    });
 

	
 
    Tester::new_single_source_expect_err(
 
        "goto jumping into select case skipping variable",
 
        "primitive f(in<u32> i) {
 
            goto waza;
 
            sync select {
 
                auto a = get(i) -> {
 
                    waza: a += 1;
 
                }
 
            }
 
        }"
 
    ).error(|e| { e
 
        .assert_num(1)
 
        .assert_msg_has(0, "not find this label")
 
        .assert_occurs_at(0, "waza;");
 
    });
 
}
 

	
 
#[test]
0 comments (0 inline, 0 general)