Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

UTBot tries to use internal kotlin.collections.EmptySet object #1284

Open
Assignees
Labels
ctg-bugIssue is a bug lang-kotlinIssue is related to Kotlin language support
@tyuldashev

Description

Description

When user code has Set as return type then UTBot tries to import internal kotlin.collections.EmptySet to initialize actual value.

To Reproduce

Steps to reproduce the behavior:

  1. In UTBot settings set Generated test language to Kotlin
  2. Generate tests for following code
class EmptySetProblem {
 fun issuesWithEmptyDescription(issues: Set<String>): Set<String> {
 return issues.filter { it.length < 5 }.toSet()
 }
}

Expected behavior

Compilable tests are generated

Actual behavior
Generated tests cannot be executed because code has error

 @Test
 @DisplayName("issuesWithEmptyDescription: issues = test collection")
 fun testIssuesWithEmptyDescription() {
 val emptySetProblem = EmptySetProblem()
 val issues = HashSet()
 issues.add("aqyas")
 issues.add("hxgvr")
 issues.add("aqyas")
 issues.add("yippo")
 issues.add("aqyas")
 
 val actual = (emptySetProblem.issuesWithEmptyDescription(issues) as EmptySet)
 
 val expected = (createInstance("kotlin.collections.EmptySet") as EmptySet)
...

Visual proofs (screenshots, logs, images)
image

Metadata

Metadata

Labels

ctg-bugIssue is a bug lang-kotlinIssue is related to Kotlin language support

Type

No type

Projects

Status

Todo

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /