Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup

  • Loading branch information...
commit ad4fb395adaac76ac9e1f35fe437320e633e2f56 1 parent 4a5a96a
@danseid authored
View
10 src/main/kotlin/spec/matchers/AnyMatcher.kt
@@ -16,18 +16,12 @@ trait Matcher {
open class AnyBeMatcher<T>(val target: T): Matcher {
inline fun equal(value: T) = if (value != target) fail(value, target)
-
- open inline fun any(values: List<T>) {
- if(!values.any { it == target }) fail("any of $values", target)
- }
+ open inline fun any(values: List<T>) = if(!values.any { it == target }) fail("any of $values", target)
}
open class AnyNotBeMatcher<T>(val target: T): Matcher {
inline fun equal(value: T) = if (value == target) fail(value, target)
-
- open inline fun any(values: List<T>) {
- if(values any { it == target }) fail("not any of $values", target)
- }
+ open inline fun any(values: List<T>) = if(values any { it == target }) fail("not any of $values", target)
}
View
9 src/main/kotlin/spec/matchers/Should.kt
@@ -1,15 +1,17 @@
package spec.matchers
+
/**.
* User: Daniel Seidler
* Date: 15.11.12
* Time: 12:22
*/
-// ANY MATCHER
+/* SHOULD MATCHER*/
+// ANY
public fun <T>T.should(val verb: BE): AnyBeMatcher<T> = AnyBeMatcher(this)
public fun <T>T.should(val verb: NOTBE): AnyNotBeMatcher<T> = AnyNotBeMatcher(this)
-//STRING MATCHER
+//STRING
public fun String.should(val verb: HAVE): StringHaveMatcher = StringHaveMatcher(this)
public fun String.should(val verb: NOTHAVE): StringNotHaveMatcher = StringNotHaveMatcher(this)
public fun String.should(val verb: START): StringStartMatcher = StringStartMatcher(this)
@@ -19,7 +21,6 @@ public fun String.should(val verb: NOTEND): StringNotEndMatcher = StringNotEndMa
public fun String.should(val verb: CONTAIN): StringContainMatcher = StringContainMatcher(this)
public fun String.should(val verb: NOTCONTAIN): StringNotContainMatcher = StringNotContainMatcher(this)
-
-//FUNCTION MATCHER
+//FUNCTION
public fun <R>jet.Function0<R>.should(verb: FAIL): FunctionFailMatcher<R> = FunctionFailMatcher(this)
public fun <R>jet.Function0<R>.should(verb: NOTFAIL): FunctionNotFailMatcher<R> = FunctionNotFailMatcher(this)
View
1  src/main/kotlin/spec/matchers/Verb.kt
@@ -7,7 +7,6 @@ package spec.matchers
*
*/
trait Verb {
-
}
public class BE: Verb {
Please sign in to comment.
Something went wrong with that request. Please try again.