<commit_before>package assertk

import assertk.assertions.support.show

class Assert<out T> internal constructor(val name: String? = null, val actual: T)

sealed class AssertBlock<out T> {
    abstract fun throwsError(f: (Assert<Throwable>) -> Unit)
    abstract fun returnsValue(f: (Assert<T>) -> Unit)

    class Value<out T> internal constructor(private val value: T) : AssertBlock<T>() {
        override fun throwsError(f: (Assert<Throwable>) -> Unit) = fail("expected exception but was:${show(value)}")

        override fun returnsValue(f: (Assert<T>) -> Unit) {
            f(Assert(actual = value))
        }
    }

    class Error<out T> internal constructor(private val error: Throwable) : AssertBlock<T>() {
        override fun throwsError(f: (Assert<Throwable>) -> Unit) {
            f(Assert(actual = error))
        }

        override fun returnsValue(f: (Assert<T>) -> Unit) = fail("expected value but threw:${show(error)}")
    }
}

fun <T> assert(actual: T): Assert<T> = Assert(null, actual)

fun <T> assert(actual: T, name: String?): Assert<T> = Assert(name, actual)

fun <T> assert(actual: T, f: (Assert<T>) -> Unit) {
    FailureContext.run(SoftFailure()) {
        f(Assert(null, actual))<commit_msg>Replace overload with default value<commit_after>package assertk

import assertk.assertions.support.show

class Assert<out T> internal constructor(val name: String? = null, val actual: T)

sealed class AssertBlock<out T> {
    abstract fun throwsError(f: (Assert<Throwable>) -> Unit)
    abstract fun returnsValue(f: (Assert<T>) -> Unit)

    class Value<out T> internal constructor(private val value: T) : AssertBlock<T>() {
        override fun throwsError(f: (Assert<Throwable>) -> Unit) = fail("expected exception but was:${show(value)}")

        override fun returnsValue(f: (Assert<T>) -> Unit) {
            f(Assert(actual = value))
        }
    }

    class Error<out T> internal constructor(private val error: Throwable) : AssertBlock<T>() {
        override fun throwsError(f: (Assert<Throwable>) -> Unit) {
            f(Assert(actual = error))
        }

        override fun returnsValue(f: (Assert<T>) -> Unit) = fail("expected value but threw:${show(error)}")
    }
}

fun <T> assert(actual: T, name: String? = null): Assert<T> = Assert(name, actual)

fun <T> assert(actual: T, f: (Assert<T>) -> Unit) {
    FailureContext.run(SoftFailure()) {
        f(Assert(null, actual))
{'fraction_non_alphanumeric': 0.14846980976013235, 'fraction_numerical': 0.0, 'mean_word_length': 3.651923076923077, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4918303', 'n_tokens_mistral': 739, 'n_tokens_neox': 727, 'n_words': 207}