[Native][tests] Warn when committed TestFile is committed again

This commit is contained in:
Dmitriy Dolovov
2021-11-12 17:47:39 +03:00
parent c014daf1b2
commit 24f00f8fda
@@ -46,13 +46,13 @@ internal class TestFile<M : TestModule> private constructor(
// An optimization to release the memory occupied by numerous file texts. // An optimization to release the memory occupied by numerous file texts.
fun commit() { fun commit() {
state = when (val state = state) { when (val state = state) {
is State.Uncommitted -> { is State.Uncommitted -> {
location.parentFile.mkdirs() location.parentFile.mkdirs()
location.writeText(state.text) location.writeText(state.text)
State.Committed this.state = State.Committed
} }
is State.Committed -> state is State.Committed -> System.err.println("$this has been committed again. Need to check why this had happened.")
} }
} }