spaceship-prompt / spaceship-prompt

:rocket::star: Minimalistic, powerful and extremely customizable Zsh prompt
https://spaceship-prompt.sh
MIT License
19.52k stars 963 forks source link

Tests for Spaceship #75

Closed denysdovhan closed 2 years ago

denysdovhan commented 7 years ago

Currently, there aren't tests for Spaceship. Would be great if we find a way to lint or test this theme somehow.

Open for discussion.

ghost commented 7 years ago

I would be interested it looking into what automated testing could be applied.

salmanulfarzy commented 7 years ago

shunit2 seems to be a good option. bhilburn/powerlevel9k theme has a test suit with shunit2. There is also a discussion about testing themes in here by @denysdovhan

Huge change to theme is being developed with #78 . So, It might be better to hold off testing until it's merged.

denysdovhan commented 7 years ago

I'm not sure about unit testing library. Don't know how to implement tests properly. Actually, I was wondering about creating unified code base in one of high level scripting languages, like Python or JavaScript. Beside single code base there should be a loaders (adapters) for different shells. On my opinion, with that approach we can achieve few important benefits:

That's just an idea, but here is my attempt with default Oh-My-Zsh theme — robbyrussell. What do you think?

jwkicklighter commented 7 years ago

@denysdovhan what is the speed like with the rewritten JS version of robbyrussel?

denysdovhan commented 6 years ago

@jwkicklighter we didn't achieve significant performance speed up.

denysdovhan commented 6 years ago

@salmanulfarzy @maximbaz I'd like to pay your attention to this issue since it should have top priority for us. Spaceship has a lot of sections and it's easy to break something without noticing. We should finally find the way to test Spaceship at least for basic functionality.

jwkicklighter commented 6 years ago

@denysdovhan I was more concerned with it being less performant, which I guess it isn't based on your comment

salmanulfarzy commented 6 years ago

I've no idea where to begin from and what to test. There isn't much to take reference from prompts that are tested. But following the powerlevel9K path, Made a single passing test about char section and confused about how to proceed. If this the right approach, I can make a WIP pull request that we can further work.

ZUnit looks promising with powerful assertion library for Zsh specific testing. I haven't worked on this yet.

denysdovhan commented 6 years ago

@salmanulfarzy your example of tests for chat section LGTM. I would prefer to use shunit since it's more trusted and battle-tested. Can you give any advantages of using Zunit?

matchai commented 6 years ago

I'm actively working on writing tests for all sections that have been ported from spaceship to spacefish so far. If it would help get this PR started, I encourage you to port over our tests, which should cover the same functional use cases: https://github.com/matchai/spacefish/tree/master/tests

denysdovhan commented 2 years ago

Follow #458 for updates.