How can I run the tests in the libraries module?


#1

Hi!

I’ve added an extension method to the String class. My addition is pure Kotlin code so I hope my unit test can be a pure Kotlin one as well.
I’ve put my extension method in kotlin/libraries/stdlib/src/kotlin/Strings.kt.

After that I wrote a test in kotlin/libraries/stdlib/test/StringTest. (not .kt here)

No matter with run configuration I try it seems my test isn’t run. I’ve made the test so it fail, but I don’t think it’s being run at all, or maybe the detection of fails doesn’t work.

So, can someone more familiar with the source code point me where I can put my unit test?

Regards, Tommy


#2

As far as I understood, you are trying to modify Kotlin repository.

To work with stdlib sources and tests, you need to open stdlib project (instead of Kotlin root project) with Kotlin plugin installed. The easiest way to do it is to run “IDEA” configuration from Kotlin root project. To open stdlib project, you need to open kotlin/libraries/stdlib/pom.xml as a project. After that, you can run StringTest.kt file. If you want to run all stdlib tests, use Maven goal “test”.


#3

Another bit of information: everything in the libraries directory is built with Maven. To make sure everything's fine, I'd recommend to run

``

mvn clean mvn install

in this directory (it will run the tests among other things).

Please, refer to the ReadMe file.


#4

Great answers, thanks!

I’ll try this later today.

Now I just have to convince OS X 10.8.2 to not use Java 7 on the command line. They removed the Java Preferences recently. I hope it’s just a symbolic link somwhere in /Libraries I can change. :slight_smile:

Regards, Tommy