Atrium: listAssertions for the new infix API

Created on 18 Oct 2019  路  6Comments  路  Source: robstoll/atrium

Platform (jvm, js, android): jvm
Extension (none, kotlin 1.3, jdk8): none

Code related list

We want to migrate the api-cc-infix-en_GB... modules which are based on Assert to Expect. We have already created the corresponding
modules api-infix-en_GB.... Also there are already fluent-en_GB... modules where we have already done the transition from Assert to Expect

Following the things you need to do:

  • copy the file listAssertions.kt from atrium-api-fluent-en_GB-common to atrium-api-infix-en_GB-common
  • copy the ListFeatureAssertionsSpec.kt from atrium-api-fluent-en_GB-common to atrium-api-infix-en_GB-common

    • introduce a function in the companion object for each assertion function so that we see the infix API in action (see ListFeatureAssertionsSpec in atrium-api-cc-infix-en_GB-jvm but use fun1, fun2 etc. to retrieve the name of the function instead of KFunction<...> -- use fun1<..>(...).name)

Your first contribution?

  • Write a comment I'll work on this if you would like to take this issue over.
    This way we get the chance to revise the description in case things have changed in the meantime,
    we might give you additional hints and we can assign the task to you, so that others do not start as well.
  • See Your first code contribution for guidelines.
  • Do not hesitate to ask questions here or to contact us via Atrium's slack channel if you need help
    (Invite yourself in case you do not have an account yet).
good first issue hacktoberfest help wanted

All 6 comments

I'll work on this

I'll work on this

Question:
What to do with

infix fun <E : Any, T: List<E>> Expect<T>.get(index: Index): ListGetOption<E, T>
    = ListGetOption.create(this, index.index)

Do I need also to copy ListGetOption class and provide a fluent builder to finish the assertion? Seems like I can remove this during migration, but not sure.
The same about Index data class. It just holds integer index, does it make sense to keep it?

First of all, I am open for new ideas. Currently the infix API for List looks as follows:
https://github.com/robstoll/atrium/blob/master/apis/differences.md#list-get

Unless you have a different idea how we can provide an infix api without Index and ListGetOption (please name it ListGetStep though, we want to move away from using Option in naming) you have to migrate it (copy&paste basically)

OMG, sorry.
I looked at different file :(
I looked in package atrium-api-cc-infix-en_GB-common instead of atrium-api-fluent-en_GB-common and did totally wrong thing for an hour now.
Reverting back my stuff and going to do it from the scratch.

You're not wrong at all. In the end it is a migration from atrium-api-cc-infix-en_GB-common to atrium-api-infix-en_GB-common and ListGetOption is something you will not find in atrium-api-fluent-en_GB-common

Was this page helpful?
0 / 5 - 0 ratings