-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f914e44
commit 452ff43
Showing
5 changed files
with
91 additions
and
2 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
59 changes: 59 additions & 0 deletions
59
tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/sandbox/DummyTest.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,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)); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/jballerina-unit-test/src/test/resources/test-src/query/test.bal
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,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; | ||
}; | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/jballerina-unit-test/src/test/resources/test-src/sandbox/dummy.bal
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,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; | ||
}; | ||
} |