Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lazy message variants for because, feature, Untranslatable, etc #1341

Open
vlsi opened this issue Feb 23, 2023 · 1 comment
Open

Add lazy message variants for because, feature, Untranslatable, etc #1341

vlsi opened this issue Feb 23, 2023 · 1 comment
Labels
needs votes otherwise it will be ignored

Comments

@vlsi
Copy link
Collaborator

vlsi commented Feb 23, 2023

Code related feature

Currently, atrium forces early string instantiation, which does not play nicely with adding descriptions lazily

It would be nice to have something like

expect(2)
  .because { "lazy $message" }
  .toEqual(4)

// For usage like _logic.manualFeature(LazyUntranslatable(messageSupplier), ...
class LazyUntranslatable(
    private val representation: () -> String
): Translatable {
    override val name: String
        get() = getDefault()

    override fun getDefault(): String = representation.invoke()
}
@robstoll
Copy link
Owner

we had this once for feature but dropped it because the performance win you get is most likely insignificant compared to test setup etc.
readable tests and less overloads in the API seemed more important to us.
Hence, what is your use case that you want it?

@robstoll robstoll added the needs votes otherwise it will be ignored label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs votes otherwise it will be ignored
Projects
None yet
Development

No branches or pull requests

2 participants