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

Check types with AssertEqual/AssertNotEqual #111

Merged
merged 1 commit into from
Jan 29, 2017

Conversation

blueyed
Copy link
Collaborator

@blueyed blueyed commented Jan 7, 2017

This should be done only for incompatible types maybe (i.e. when
comparing list/dict with something else).

This is meant to make the error when comparing a list with something
else more meaningful, where you currently get the following only:

Vim(if):E691: Can only compare List with List

@blueyed
Copy link
Collaborator Author

blueyed commented Jan 7, 2017

When this (and #107) get accepted, this needs to be hidden from the stacktrace also:

> in <SNR>34_check_types, line 3
>   throw get(a:000, 2, printf("type mismatch: %s (%s) should be equal to %s (%s)", string(got), get(s:type_names, type(got), type(got)), string(exp), get(s:type_names, type(exp), type(exp))))
> in vader#assert#equal[4]
>   call s:check_types(exp, got)
> tests/utils.vader:133: AssertEqual GetSetting('setting'), 42

The easy way would be to rename the function to vader#assert#_check_types or something similar, but also excluding everything after vader#assert would work.

@blueyed
Copy link
Collaborator Author

blueyed commented Jan 27, 2017

Would fix #115.

@junegunn
Copy link
Owner

Thanks, can you update the failing test case (AssertEqual 4, $ENVVAR)?

@blueyed blueyed changed the title [RFC] Check types with AssertEqual/AssertNotEqual Check types with AssertEqual/AssertNotEqual Jan 28, 2017
This is meant to make the error when comparing a list with something
else more meaningful, where you currently get the following only:

> Vim(if):E691: Can only compare List with List

Fixes junegunn#115.
Closes junegunn#116.
@blueyed
Copy link
Collaborator Author

blueyed commented Jan 28, 2017

Done. Env vars are strings always.

@junegunn junegunn merged commit 427fe19 into junegunn:master Jan 29, 2017
@junegunn
Copy link
Owner

Thanks!

@blueyed blueyed deleted the check-types branch January 29, 2017 13:50
hupfdule pushed a commit to hupfdule/vader.vim that referenced this pull request May 6, 2020
This is meant to make the error when comparing a list with something
else more meaningful, where you currently get the following only:

> Vim(if):E691: Can only compare List with List

Fixes junegunn#115.
Closes junegunn#116.
hupfdule pushed a commit to hupfdule/vader.vim that referenced this pull request May 28, 2020
This is meant to make the error when comparing a list with something
else more meaningful, where you currently get the following only:

> Vim(if):E691: Can only compare List with List

Fixes junegunn#115.
Closes junegunn#116.
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

Successfully merging this pull request may close these issues.

2 participants