[Test] Add ability to remove default directives in test configuration
This commit is contained in:
committed by
TeamCityServer
parent
e3c7bd5f85
commit
e6fd74f368
+12
@@ -16,6 +16,10 @@ class RegisteredDirectivesBuilder {
|
|||||||
simpleDirectives += this
|
simpleDirectives += this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator fun SimpleDirective.unaryMinus() {
|
||||||
|
simpleDirectives.remove(this)
|
||||||
|
}
|
||||||
|
|
||||||
infix fun StringDirective.with(value: String) {
|
infix fun StringDirective.with(value: String) {
|
||||||
with(listOf(value))
|
with(listOf(value))
|
||||||
}
|
}
|
||||||
@@ -24,6 +28,10 @@ class RegisteredDirectivesBuilder {
|
|||||||
stringDirectives.putWithExistsCheck(this, values)
|
stringDirectives.putWithExistsCheck(this, values)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator fun StringDirective.unaryMinus() {
|
||||||
|
stringDirectives.remove(this)
|
||||||
|
}
|
||||||
|
|
||||||
infix fun <T : Any> ValueDirective<T>.with(value: T) {
|
infix fun <T : Any> ValueDirective<T>.with(value: T) {
|
||||||
with(listOf(value))
|
with(listOf(value))
|
||||||
}
|
}
|
||||||
@@ -32,6 +40,10 @@ class RegisteredDirectivesBuilder {
|
|||||||
valueDirectives.putWithExistsCheck(this, values)
|
valueDirectives.putWithExistsCheck(this, values)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator fun ValueDirective<*>.unaryMinus() {
|
||||||
|
valueDirectives.remove(this)
|
||||||
|
}
|
||||||
|
|
||||||
private fun <K : Directive, V> MutableMap<K, V>.putWithExistsCheck(key: K, value: V) {
|
private fun <K : Directive, V> MutableMap<K, V>.putWithExistsCheck(key: K, value: V) {
|
||||||
val alreadyRegistered = put(key, value)
|
val alreadyRegistered = put(key, value)
|
||||||
if (alreadyRegistered != null) {
|
if (alreadyRegistered != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user