-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ballerina-platform/ballerina-lang…
… into config-env-var
- Loading branch information
Showing
732 changed files
with
17,599 additions
and
3,007 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...dules/shell-core/src/test/java/io/ballerina/shell/test/evaluator/ActionEvaluatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://wso2.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.ballerina.shell.test.evaluator; | ||
|
||
import io.ballerina.shell.exceptions.BallerinaShellException; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Test simple snippets with action invocations. | ||
* | ||
* @since 2201.9.0 | ||
*/ | ||
public class ActionEvaluatorTest extends AbstractEvaluatorTest { | ||
private static final String START_EVALUATOR_TESTCASE = "testcases/evaluator/actions.start.json"; | ||
private static final String REMOTE_EVALUATOR_TESTCASE = "testcases/evaluator/actions.remote.json"; | ||
private static final String RESOURCE_EVALUATOR_TESTCASE = "testcases/evaluator/actions.resource.json"; | ||
private static final String VAR_EVALUATOR_TESTCASE = "testcases/evaluator/actions.var.json"; | ||
|
||
@Test | ||
public void testEvaluateStart() throws BallerinaShellException { | ||
testEvaluate(START_EVALUATOR_TESTCASE); | ||
} | ||
|
||
@Test | ||
public void testEvaluateRemote() throws BallerinaShellException { | ||
testEvaluate(REMOTE_EVALUATOR_TESTCASE); | ||
} | ||
|
||
@Test | ||
public void testEvaluateResource() throws BallerinaShellException { | ||
testEvaluate(RESOURCE_EVALUATOR_TESTCASE); | ||
} | ||
|
||
@Test | ||
public void testEvaluateVar() throws BallerinaShellException { | ||
testEvaluate(VAR_EVALUATOR_TESTCASE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...erina-shell/modules/shell-core/src/test/resources/testcases/evaluator/actions.remote.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"description": "Define a client class", | ||
"code": "client class MyClient { remote function invoke(string param) returns string { return string `remote method invoked with ${param}`; } }" | ||
}, | ||
{ | ||
"description": "Initialize a client class", | ||
"code": "MyClient myClient = new;" | ||
}, | ||
{ | ||
"description": "Invoke a client remote method as an expression", | ||
"code": "myClient->invoke(\"input\");", | ||
"expr": "\"remote method invoked with input\"" | ||
}, | ||
{ | ||
"description": "Invoke a client remote method with a variable", | ||
"code": "string returnValue = myClient->invoke(\"input\");" | ||
}, | ||
{ | ||
"description": "Check the return value", | ||
"code": "returnValue", | ||
"expr": "\"remote method invoked with input\"" | ||
} | ||
] |
24 changes: 24 additions & 0 deletions
24
...ina-shell/modules/shell-core/src/test/resources/testcases/evaluator/actions.resource.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"description": "Define a client class", | ||
"code": "client class MyClient { resource function get root/[string path](string param) returns string { return string `${path} -> ${param}`; } }" | ||
}, | ||
{ | ||
"description": "Initialize a client class", | ||
"code": "MyClient myClient = new;" | ||
}, | ||
{ | ||
"description": "Invoke a client resource method as an expression", | ||
"code": "myClient ->/root/name(\"input\");", | ||
"expr": "\"name -> input\"" | ||
}, | ||
{ | ||
"description": "Invoke a client resource method with a variable", | ||
"code": "string returnValue = myClient ->/root/name(\"input\");" | ||
}, | ||
{ | ||
"description": "Check the return value", | ||
"code": "returnValue", | ||
"expr": "\"name -> input\"" | ||
} | ||
] |
20 changes: 20 additions & 0 deletions
20
ballerina-shell/modules/shell-core/src/test/resources/testcases/evaluator/actions.start.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"description": "Initialize the function", | ||
"code": "function name() returns int { int x = 3; x += 3 * 2; return x; }" | ||
}, | ||
{ | ||
"description": "Execute the function with start as an expression", | ||
"code": "start name()", | ||
"expr": "future {isDone:true,result:9}" | ||
}, | ||
{ | ||
"description": "Execute the function with start with a variable assignment", | ||
"code": "future<int> futureResult = start name()" | ||
}, | ||
{ | ||
"description": "Check the return value", | ||
"code": "futureResult", | ||
"expr": "future {isDone:true,result:9}" | ||
} | ||
] |
14 changes: 14 additions & 0 deletions
14
ballerina-shell/modules/shell-core/src/test/resources/testcases/evaluator/actions.var.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"description": "Initialize the function", | ||
"code": "function name() returns int { int x = 3; x += 3 * 2; return x; }" | ||
}, | ||
{ | ||
"description": "Execute the function with start with a variable assignment", | ||
"code": "var futureResult = start name()", | ||
"stderr": [ | ||
"'var' type is not yet supported for actions. Please specify the exact type.", | ||
"Compilation aborted due to invalid input." | ||
] | ||
} | ||
] |
Oops, something went wrong.