Skip to content

Modernize tests #104

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

Open
2 tasks
zardoy opened this issue Jan 25, 2023 · 2 comments
Open
2 tasks

Modernize tests #104

zardoy opened this issue Jan 25, 2023 · 2 comments

Comments

@zardoy
Copy link
Contributor

zardoy commented Jan 25, 2023

Hi! I want to record a general issue of my thoughts about your testbase and difficulties that I faced so far.

For me it always wasnt easy to define or read multiline tests with >> format. Its not that hard to define new tests with column-edit, but IMO its better to define them in a way with syntax highlight support, so its easier to read / change and paste for new contributors.

Just compare:

Screenshot 2023-01-26 at 00 29 18

Its just a proposal so feel free to decline it if you have a reason for this format.

Btw I was wondering for along time why some tests are using trimWhitespaces option?

@ipatalas
Copy link
Owner

Hmm, I like the idea but have mixed feelings. The old way was better in a way that you can see the code before and after side by side and it was quite easy to read (for me).
In this case it's one below another but I can see the benefits of having this syntax highlight because this code is so much easier to read than when it's plain string. Let me think about it.
I think this could be done as an another overload so that we still have option to use the old way for tests where it could make more sense.

Btw I was wondering for along time why some tests are using trimWhitespaces option?

If I remember correctly it was originally added for all templates which introduce blocks with curly braces. That was because VSCode was formatting that code by default when executing the template and it was harder to write an assert for that.
I'm not 100% sure it's really needed for all tests which contain it now (might have been too much copy-paste somewhere).
Now when I think about it it should be possible to turn this feature off for tests and then this wouldn't be necessary at all.

@zardoy
Copy link
Contributor Author

zardoy commented Jan 27, 2023

In this case it's one below another but I can see the benefits of having this syntax highlight because this code is so much easier to read than when it's plain string. Let me think about it.

This traditional format definitely has even more advantages for bigger test strings, but probably the biggest advantage is that you can instantly see postfix location (in screenshot above I used block comment for it), in both cases you need to format string manually but in old way you need to more work in inserting spaces, though I don't mind both

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