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 Expect<Map<K, V>>.values -> Expect<Collection<Map.Entry<K, V>> feature extractor #1356

Closed
vlsi opened this issue Mar 15, 2023 · 3 comments

Comments

@vlsi
Copy link
Collaborator

vlsi commented Mar 15, 2023

Code related feature

val map = mapOf("a" to 1, "b" to 2")

expect(map) {
  entries.toHaveElementsAndAll { ... }
}

There are

val <V, T : Map<*, V>> Expect<T>.values: Expect<Collection<V>>

val <K, T : Map<out K, *>> Expect<T>.keys: Expect<Set<K>>

However, there is no .entries property.

I see there is asEntries(), however, it is not clear why the names are inconsistent.

@vlsi vlsi changed the title Add Map<K, V> -> Map.Entry<K, V> feature extractor Add Expect<Map<K, V>>.values -> Expect<Collection<Map.Entry<K, V>> feature extractor Mar 15, 2023
@robstoll
Copy link
Owner

we use as... to transform the subject without it being reported (in contrast to a feature extraction). you can still use its { entries } if you like.
Do you actually want to see the transformation?

@vlsi
Copy link
Collaborator Author

vlsi commented Mar 17, 2023

I do not want to see the transformation.
I was searching the way to add expectations for map entries, and it was surprising why keys and values were there, and entries was missing.

I'm not sure if enforcing as... convention for non-reported extractors is good or bad, however, it would probably make sense to document those naming conventions so the users could understand the common theme.

However, I think the use of non-reported .values for Map would not be surprising for the users.

@vlsi vlsi closed this as completed Mar 17, 2023
@robstoll
Copy link
Owner

I'm not sure if enforcing as... convention for non-reported extractors is good or bad,

Me neither actually. In case you have time, take a look at robstoll/atrium-roadmap#44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants