Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation tests for ports in main or federated reactor #1091

Merged
merged 1 commit into from
Apr 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,86 @@ public void testUnnamedReactor() throws Exception {
"Reactor must be named.");
}

@Test
public void testMainHasInput() throws Exception {
// Java 17:
// String testCase = """
// target C;
// main reactor {
// input x:int;
// }
// """
// Java 11:
String testCase = String.join(System.getProperty("line.separator"),
"target C;",
"main reactor {",
" input x:int;",
"}"
);
validator.assertError(parseWithoutError(testCase), LfPackage.eINSTANCE.getInput(), null,
"Main reactor cannot have inputs.");
}

@Test
public void testFederatedHasInput() throws Exception {
// Java 17:
// String testCase = """
// target C;
// federated reactor {
// input x:int;
// }
// """
// Java 11:
String testCase = String.join(System.getProperty("line.separator"),
"target C;",
"federated reactor {",
" input x:int;",
"}"
);
validator.assertError(parseWithoutError(testCase), LfPackage.eINSTANCE.getInput(), null,
"Main reactor cannot have inputs.");
}

@Test
public void testMainHasOutput() throws Exception {
// Java 17:
// String testCase = """
// target C;
// main reactor {
// output x:int;
// }
// """
// Java 11:
String testCase = String.join(System.getProperty("line.separator"),
"target C;",
"main reactor {",
" output x:int;",
"}"
);
validator.assertError(parseWithoutError(testCase), LfPackage.eINSTANCE.getOutput(), null,
"Main reactor cannot have outputs.");
}

@Test
public void testFederatedHasOutput() throws Exception {
// Java 17:
// String testCase = """
// target C;
// federated reactor {
// output x:int;
// }
// """
// Java 11:
String testCase = String.join(System.getProperty("line.separator"),
"target C;",
"federated reactor {",
" output x:int;",
"}"
);
validator.assertError(parseWithoutError(testCase), LfPackage.eINSTANCE.getOutput(), null,
"Main reactor cannot have outputs.");
}

@Test
public void testMultipleMainReactor() throws Exception {
// Java 17:
Expand Down