Jump to content

KUnit - Unit Testing framework for kerboscript (KSP KOS)


whirlwind

Recommended Posts

What if something is wrong? It's time to start testing the whole Kerbol system! 

KUnit - Unit Testing framework for kerboscript

KUnit provides possibility to write repeatable tests for kerboscript - KOS programming language. KUnit is an instance of the xUnit architecture for unit testing frameworks.

KUnit shouldn't force to write any tests but should help write any test you want for any code you want in case when you feel that it should be tested. There is a way how to implement, organize and run your tests. And this is KUnit. If you found this tool nice and helpful this means KUnit works well.

KUnit also demonstrates how to use object-oriented approach in KOS programs to achieve well-looking design, maximum code reusability and exceptional software quality.

Join us and together we can make Kerbol more robust!

Edited by whirlwind
Link to comment
Share on other sites

This is a great idea, but I want to pro-actively nip something in the bud before it gets too much of a following among kOS users in this thread - don't rely on the '#' operator here.  If you want to use this, this is the only officially supported syntax:

lexiconobj["key"]

and this syntax is not officially supported:

lexiconobj#key

They do the same exact thing (literally, they compile to the same kRISC opcodes), but the second one uses deprecated syntax that has been *documented as such* for quite some time now.  It is dependant on an accidental hack-y side effect that the kOS devs didn't know about.  This syntax was originally made for numerical (thus the "#") list indeces but uselessly required hardcoded literal values in the source code.  The hack-y side effect is that it also accidentally works on bare-word hardcoded literal keys for lexicons so when @whirlwind is trying to layer OOP concepts on top of the Lexicon type, @whirlwind used the "#" as if it was the member separator.

The first syntax is a bit more typing, but it's also correct, whereas the second is depending on a side effect in the implementation of the compiler that was unintended, and not even documented.  (The fact that you can use `#` for numerical literals for array indeces was documented (but documented as deprecated as we inherited that from the old original stuff and only kept it for grandfathering), but the fact that it accidentally worked on Lexicons was not even known to the devs themselves and wasn't even documented.)

KUnit is a great wonderful idea - but please please please stick to the officially supported syntax when using it and don't force me to have to keep supporting an old broken misfeature.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...