-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded to latest version of Kotlin 1.3.50
- Loading branch information
1 parent
063f87f
commit a46dc8c
Showing
4 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
*.iml | ||
target/** | ||
.DS_Store | ||
dataanon.log | ||
dataanon.log | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
package com.github.dataanon | ||
|
||
import io.kotlintest.Matcher | ||
import io.kotlintest.Result | ||
import io.kotlintest.MatcherResult | ||
|
||
|
||
interface Matchers { | ||
|
||
fun <T: Comparable<T>> beIn(range: ClosedRange<T>) = object : Matcher<T> { | ||
override fun test(value: T) = Result(value in range, "$value not in the expected range $range") | ||
override fun test(value: T) = MatcherResult(value in range, "$value not in the expected range $range","$value not in the expected range $range") | ||
} | ||
|
||
fun <T> beIn(values: Collection<T>) = object : Matcher<T> { | ||
override fun test(value: T) = Result(values.contains(value), "$value not in the collection $values") | ||
override fun test(value: T) = MatcherResult(values.contains(value), "$value not in the collection $values","$value not in the collection $values") | ||
} | ||
|
||
fun notMatches(regex: Regex) = object : Matcher<String> { | ||
override fun test(value: String) = Result(!value.contains(regex), "$value matches $regex") | ||
override fun test(value: String) = MatcherResult(!value.contains(regex), "$value matches $regex","$value matches $regex") | ||
} | ||
|
||
fun contains(str: String) = object : Matcher<String> { | ||
override fun test(value: String) = Result(value.contains(str), "$value does not contain $str") | ||
override fun test(value: String) = MatcherResult(value.contains(str), "$value does not contain $str","$value does not contain $str") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters