在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):MarkusAmshove/Kluent开源软件地址(OpenSource Url):https://github.com/MarkusAmshove/Kluent开源编程语言(OpenSource Language):Kotlin 99.8%开源软件介绍(OpenSource Introduction):KluentKluent is a "Fluent Assertions" library written specifically for Kotlin. It uses the Infix-Notations and Extension Functions of Kotlin to provide a fluent wrapper around the JUnit-Assertions. Include it via gradle/mavenKluent is hosted here at mavenCentral Kluent-Android is hosted here at mavenCentral GradleReplace {version} with the current version and chose one of the two artifacts, based on your target platform: // Add jcenter as a repository for dependencies
repositories {
mavenCentral()
}
dependencies {
// for JVM:
testImplementation 'org.amshove.kluent:kluent:{version}'
// for Android:
testImplementation 'org.amshove.kluent:kluent-android:{version}'
// To get JUnit errors from kotlin.test, to e.g. enable diff windows in failure messages
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
} MavenReplace {version} with the current version <!-- Add jcenter as a repository for dependencies -->
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
<dependency>
<groupId>org.amshove.kluent</groupId>
<artifactId>kluent</artifactId>
<version>{version}</version>
<type>pom</type>
</dependency> ExamplesMore examples can be seen on the Site or in the tests. assertEquals"hello" shouldBeEqualTo "hello" assertNotEquals"hello" shouldNotBeEqualTo "world" Assert that an Array/Iterable contains somethingval alice = Person("Alice", "Bob")
val jon = Person("Jon", "Doe")
val list = listOf(alice, jon)
list shouldContain jon Using backticksEvery method that is included in Kluent also has a "backtick version", to make it feel more like a describing sentence. Some examples: assertEquals"hello" `should be equal to` "hello" assertNotEquals"hello" `should not be equal to` "world" Building KluentAll projects of Kluent are built with Gradle The default If you plan to submit a pull request, it is also fine if you just make sure it builds and tests against To build the Android library, pass the parameter
To also build the JS module, pass
To build native, pass:
In these cases, the JVM module will also be built, because it is our primary target and everything should pass on the
JVM. To skip the JVM build, e.g. for testing only against Native or JS, pass
This command will build Where to put new featuresIf you plan to add a feature (e.g. an Assertion), it would be nice to first try adding it to the If you're unsure where to put a feature, or if you want to put something in the If you're still unsure how to make something platform independent, we can have a look together inside the PR :-) AttributionParts of the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论