From 452ff43f5e4f75b4df3d58afe5244a3834e0dca1 Mon Sep 17 00:00:00 2001 From: LakshanWeerasinghe Date: Mon, 6 Nov 2023 17:15:11 +0530 Subject: [PATCH] Sync release-1.2.46 with 1.2.x --- gradle.properties | 2 +- .../src/main/ballerina/Ballerina.toml | 2 +- .../ballerinalang/test/sandbox/DummyTest.java | 59 +++++++++++++++++++ .../test/resources/test-src/query/test.bal | 13 ++++ .../test/resources/test-src/sandbox/dummy.bal | 17 ++++++ 5 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/sandbox/DummyTest.java create mode 100644 tests/jballerina-unit-test/src/test/resources/test-src/query/test.bal create mode 100644 tests/jballerina-unit-test/src/test/resources/test-src/sandbox/dummy.bal diff --git a/gradle.properties b/gradle.properties index 3254072cbb95..1c81ef4ef803 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,6 @@ org.gradle.caching=true org.gradle.parallel=true org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.workers.max=3 -version=1.2.46 +version=1.2.47 group=org.ballerinalang bootstrappedOn=1.1.0-alpha diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/Ballerina.toml b/misc/testerina/modules/testerina-core/src/main/ballerina/Ballerina.toml index 6e122b6e2bc2..c25e996d12f2 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/Ballerina.toml +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/Ballerina.toml @@ -8,5 +8,5 @@ target = "java8" [[platform.libraries]] artifactId = "mock" version = "0.0.0" - path = "./lib/testerina-core-1.2.45.jar" + path = "./lib/testerina-core-1.2.46.jar" groupId = "ballerina" diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/sandbox/DummyTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/sandbox/DummyTest.java new file mode 100644 index 000000000000..9f5521a01ca1 --- /dev/null +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/sandbox/DummyTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.ballerinalang.test.sandbox; + +import io.ballerina.runtime.api.utils.StringUtils; +import io.ballerina.runtime.api.values.BValue; +import org.ballerinalang.test.BCompileUtil; +import org.ballerinalang.test.BRunUtil; +import org.ballerinalang.test.CompileResult; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.util.Arrays; + +/** + * Dummy test + */ +public class DummyTest { + + private CompileResult result; + + @BeforeClass + public void setup() { + this.result = BCompileUtil.compile("test-src/sandbox/dummy.bal"); + Assert.assertEquals(result.getErrorCount(), 0, Arrays.asList(result.getDiagnostics()).toString()); + } + + @Test + public void sandboxtest() { + BRunUtil.invoke(result, "main"); + } + + @AfterClass + public void tearDown() { + result = null; + } + + public static void print(Object value) { + System.out.println("############################"); + System.out.println(StringUtils.getStringValue(value, null)); + } +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/query/test.bal b/tests/jballerina-unit-test/src/test/resources/test-src/query/test.bal new file mode 100644 index 000000000000..deffb0a615b2 --- /dev/null +++ b/tests/jballerina-unit-test/src/test/resources/test-src/query/test.bal @@ -0,0 +1,13 @@ +public function main() { + from var i in 1 ... 4 + do { + int a = i; + + from var j in 1 ... 4 + do { + int b = j + i; + }; + + int c = i; + }; +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/sandbox/dummy.bal b/tests/jballerina-unit-test/src/test/resources/test-src/sandbox/dummy.bal new file mode 100644 index 000000000000..5139b756f443 --- /dev/null +++ b/tests/jballerina-unit-test/src/test/resources/test-src/sandbox/dummy.bal @@ -0,0 +1,17 @@ + +// int index = 0; + + +public function main() { + // int index = 0; + _ = from var i in [1, 2, 3, 4] + do { + int index = 0; + + from var j in [3, 4, 5] + do { + int newIndex = index + j; + }; + // int a = index; + }; +}