Skip to content

Commit

Permalink
Enabling warnings as errors (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoSignoretto authored Jun 10, 2021
1 parent fb46402 commit 59d7269
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
---

## master
* Enabled warnings as errors
* Enabled `explictApi()` mode

## 1.10.0
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ allprojects {
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url "https://plugins.gradle.org/m2/" }
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.allWarningsAsErrors = true
}
}

void setupMultiplatformLibrary(Project project, Boolean shouldPublish = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public fun <T> capture(list: CapturedList<T>): CapturedMatcher<T> {
* A slot using to fetch the method invocation and compare the property inside invocation arguments
* Usage example @see [FunctionsTest]
*/

public class Slot<T> : Captureable {
private val _captured: AtomicRef<T?> = atomic(null)
public var captured: T?
Expand All @@ -55,6 +56,7 @@ public class Slot<T> : Captureable {
_captured.value = value
}

@Suppress("UNCHECKED_CAST")
override fun storeCapturedValue(value: Any?) {
captured = value as T
}
Expand All @@ -72,6 +74,7 @@ public class CapturedList<T> : Captureable {
return _captured.access { it.toList() }
}

@Suppress("UNCHECKED_CAST")
override fun storeCapturedValue(value: Any?) {
_captured.access { it.add(value as T) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public fun <T : Mock, R> T.mock(methodName: String, arguments: Map<String, Any?>
return invocationRecorder.access { recorder ->
val invocation = Invocation(methodName = methodName, arguments = arguments)
recordInvocation(hashCode, recorder, invocation)
@Suppress("UNCHECKED_CAST")
return@access recorder.getResponse(hashCode, invocation) as R
}
}
Expand Down Expand Up @@ -185,6 +186,7 @@ public fun <T : Spy, R> T.spy(
return invocationRecorder.access { recorder ->
val invocation = Invocation(methodName = methodName, arguments = arguments)
recordInvocation(hashCode, recorder, invocation)// TODO change name
@Suppress("UNCHECKED_CAST")
val mockResponse = recorder.getResponse(
instanceHash = hashCode,
invocation = invocation,
Expand Down

0 comments on commit 59d7269

Please sign in to comment.