sigmaSd / IRust

Cross Platform Rust Repl

Home Page:https://crates.io/crates/irust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Tests

smolck opened this issue · comments

It would be nice if IRust had tests to help make sure that changes we make haven't modified IRust's functionality in a wrong or unintended way. In addition, it would allow us to setup Travis CI in the future.

Also, I think this issue goes along with #42; it may be a good idea to add tests for the refactored portions of the codebase as we do the things listed in that issue.

I'm not familiar enough with IRust ATM to know everything that should and shouldn't be tested, but if pointed to where tests are needed I'm happy to help with adding them. I know that cursor.rs is a place where tests would be nice, and after #44 is finished I can create a PR with some tests for that part of the codebase if that's a welcome change.

I'm not used to writing tests but it obviously make sense, I think the hard question is how to test terminal functions like line wrapping and terminal overflow, do we need to use mocking?
Either-way I guess we can start with simple stuff

do we need to use mocking?

I think you’re right, yes. Probably the best way (if not the only way) to do it.

Either-way I guess we can start with simple stuff

Do you want me to start with making tests for the cursor struct? Seems like a good place to start to me.

@smolck yeah that would be great! But I thnik we should wait for the refactor to settle down unless you're sure that a function wont be changed

The refactor here #74 isolated the printer struct.

It is now possible to test it, I added a couple of test to tests folder.

Hopefully future code will add tests to assert the current behaviour (now that it is possible to test)