-
Notifications
You must be signed in to change notification settings - Fork 47
Missing line separator in a generated kotlin file #842
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
Labels
comp-codegen
Issue is related to code generator
ctg-bug
Issue is a bug
lang-kotlin
Issue is related to Kotlin language support
Comments
35 tasks
Actually this issue may be irrelevant because kotlin docs are now disabled. |
Just tried to reproduce the problem with the following java & kotlin code samples. The missing line separator is present for both of them. Code to generate tests for: public void methodThrowingException1() {
int[] array = new int[1];
int a = array[2];
}
public void methodThrowingException3() {
int[] array = null;
int a = array.length;
} №2 fun methodThrowingException1() {
val array = Array<Int>(1) { 1 };
val a = array[2]
}
fun methodThrowingException2() {
val array: Array<Int>? = null
val a = array!![1]
} Generated results: @Test
fun testMethodThrowingException11() {
val simpleClass = SimpleClass()
/* This test fails because method [SimpleClass.methodThrowingException1] produces [java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 1]
SimpleClass.methodThrowingException1(SimpleClass.java:4) */
simpleClass.methodThrowingException1()
}
@Test
fun testMethodThrowingException31() {
val simpleClass = SimpleClass()
/* This test fails because method [SimpleClass.methodThrowingException3] produces [java.lang.NullPointerException]
SimpleClass.methodThrowingException3(SimpleClass.java:9) */
simpleClass.methodThrowingException3()
} №2 @Test
fun testMethodThrowingException11() {
val a = A()
/* This test fails because method [A.methodThrowingException1] produces [java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 1]
A.methodThrowingException1(Main.kt:4) */
a.methodThrowingException1()
}
@Test
fun testMethodThrowingException21() {
val a = A()
/* This test fails because method [A.methodThrowingException2] produces [java.lang.NullPointerException]
A.methodThrowingException2(Main.kt:9) */
a.methodThrowingException2()
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
comp-codegen
Issue is related to code generator
ctg-bug
Issue is a bug
lang-kotlin
Issue is related to Kotlin language support
Description
When UTBot generates kotlin file with a failing test, there is a missing line separator in it.
To Reproduce
Steps to reproduce the behavior:
Example:
Expected behavior
A line with "/* This test fails because...", line separator and line that fails
Actual behavior
Missing line separator
Visual proofs (screenshots, logs, images)
Environment
No specific environment is required.
Additional context
There is no additional context.
The text was updated successfully, but these errors were encountered: