kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

testing framework? #434

Closed raould closed 8 years ago

raould commented 8 years ago

If I wanted to write some asserts or unit tests or that kind of thing, is there a standard way to do that? Can I have more than one .k source file to keep them separate? I haven't seen or figured out how one would set up such a thing. :-) Thanks for any example projects to look at.

I just noticed something about the P() macro, if that is at all relevant, but haven't figured out how to use it yet.

tavmem commented 8 years ago

There are several routes you could go for testing. Here are 3:

1) src/tests.c has over 1000 tests (which are in effect, assertions). You could add tests to that file. or you could replace that file with your own version.

2) Eventually, any script written for k2.8 through k3.2 should give the same results when run with Kona. See the repository https://github.com/tavmem/nsl for a couple of examples used for testing.

3) You could use Travis (see closed issue #360).

If by ".k source file" you mean a k-script. then yes, you can have as many as you want, and keep them separate.

Note that the kona wiki is not the only place to learn from. See the LINKS in the wiki to souces like the K2.0 reference manual and the K2.0 user manual.

raould commented 8 years ago

Thanks. (1) is not what I want because I don't want to write C, I want to write K. :-) (2) helps me understand that I can go read K docs (but not Q or KDB+ docs I guess) and learn from those, thanks!