Skip to content

Commit

Permalink
Merge pull request #122 from edwin1729/master
Browse files Browse the repository at this point in the history
test generation for classes not in a package (default package)
  • Loading branch information
AbdullinAM authored Aug 27, 2024
2 parents 33575b7 + 66fc329 commit 6e784f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ val Method.validName get() = name.replace(Regex("[^a-zA-Z0-9]"), "")
val BasicBlock.validName get() = name.toString().replace(Regex("[^a-zA-Z0-9]"), "")


val Method.packageName get() = klass.pkg.concreteName
// If there is no package assign an arbitrary package name 'example'
// This is necessary since tests generated by kex use the same package structure and imports are made from helper files
// In java imports are not possible from the default package
val Method.packageName get() = klass.pkg.concreteName.ifBlank { kexConfig.getStringValue("testGen", "defaultPackageName", "example") }
val Method.klassName get() = "${klass.validName}_${validName}_${abs(hashCode())}"

abstract class TestCasePrinter(
Expand Down
1 change: 1 addition & 0 deletions kex.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ compileDir = compiled/
[testGen]
enabled = true
testsDir = tests/
defaultPackageName = example
accessLevel = private
testCaseLanguage = java
generateSetup = true
Expand Down

0 comments on commit 6e784f3

Please sign in to comment.