diff --git a/src/runtime2/tests/mod.rs b/src/runtime2/tests/mod.rs index 823efa16f04108cbd8061cfaf249914b7bde1a60..1573f0d1553fd3fe55c93a78503402ae19c7beef 100644 --- a/src/runtime2/tests/mod.rs +++ b/src/runtime2/tests/mod.rs @@ -132,4 +132,41 @@ fn test_simple_select() { ").expect("compilation"); let rt = Runtime::new(3, false, pd); create_component(&rt, "", "constructor", no_args()); +} + +#[test] +fn test_empty_select() { + let pd = ProtocolDescription::parse(b" + primitive constructor() { + u32 index = 0; + while (index < 5) { + sync select { auto v = () -> print(\"hello\"); } + index += 1; + } + } + ").expect("compilation"); + let rt = Runtime::new(3, false, pd); + create_component(&rt, "", "constructor", no_args()); +} + +#[test] +fn test_empty_select_should_not_work() { + 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\"); + } + print(\"after while\"); + } + ").expect("compilation"); + let rt = Runtime::new(3, false, pd); + create_component(&rt, "", "constructor", no_args()); } \ No newline at end of file