diff --git a/src/runtime2/tests/mod.rs b/src/runtime2/tests/mod.rs index 1573f0d1553fd3fe55c93a78503402ae19c7beef..2a481ff71dd208cea4ea0b3705c1192256b281a3 100644 --- a/src/runtime2/tests/mod.rs +++ b/src/runtime2/tests/mod.rs @@ -135,36 +135,37 @@ fn test_simple_select() { } #[test] -fn test_empty_select() { +fn test_unguarded_select() { let pd = ProtocolDescription::parse(b" - primitive constructor() { + primitive constructor_outside_select() { u32 index = 0; while (index < 5) { sync select { auto v = () -> print(\"hello\"); } index += 1; } } + + primitive constructor_inside_select() { + u32 index = 0; + while (index < 5) { + sync select { auto v = () -> index += 1; } + } + } ").expect("compilation"); let rt = Runtime::new(3, false, pd); - create_component(&rt, "", "constructor", no_args()); + create_component(&rt, "", "constructor_outside_select", no_args()); + create_component(&rt, "", "constructor_inside_select", no_args()); } #[test] -fn test_empty_select_should_not_work() { +fn test_empty_select() { let pd = ProtocolDescription::parse(b" primitive constructor() { u32 index = 0; - print(\"before while\"); while (index < 5) { - print(\"before sync\"); - sync { - print(\"before select\"); - select { } - print(\"after select\"); - } - print(\"after sync\"); + sync select {} + index += 1; } - print(\"after while\"); } ").expect("compilation"); let rt = Runtime::new(3, false, pd);