d-unsed / ruru

Native Ruby extensions written in Rust
MIT License
834 stars 40 forks source link

Add multiple methods to Array #38

Closed simon0191 closed 8 years ago

simon0191 commented 8 years ago

I would like to add some tests. I was thinking of creating a ruby project and add rspec tests. What do you think @d-unseductable ?

malept commented 8 years ago

As a note for anyone looking at this, it requires https://github.com/steveklabnik/ruby-sys/pull/10 to be released.

elifoster commented 8 years ago

Regarding tests, Travis does not support multi language stuff, so if you wanted it done through CI you'd either need a script to install either rust or ruby (I'd go with rust tbh, much simpler) or to use multiple CI services.

malept commented 8 years ago

It's not too difficult to run both Rust and Ruby tests with Travis CI, I do so in rusty_blank (powered by Ruru).

My personal preference is to have Ruby tests written with minitest because that's what's already bundled with Ruby and it's similar to how Rust tests are written. But it's not my project, so I'll leave it up to @d-unseductable.

d-unsed commented 8 years ago

@elifoster, do you mean the ```ruby sections in documentation?

Those are just examples and they are not executed with CI. Every rust example (doctest) has its corresponding ruby example which is basically the same code written in ruby. IMO it's sometimes easier for users to understand an example reading both rust code and its ruby analog.

@malept, it's a good idea to have rspec/minitest test suite.

Since most of the ruru methods are just simple bindings (receive and process arguments and call the corresponding ruby-sys function, like Array.push() or RString::new()), IMO one test (doctest) per method is enough to be sure that those bindings work correctly.

For more complicated cases I wanted to have integration tests using ruby test frameworks, but at that time it was problematic to set the things up. It was quite a long time ago, before thermite was created. So maybe it's good time to try it once again :)

simon0191 commented 8 years ago

👌 Working on:

d-unsed commented 8 years ago

Great job, @simon0191! Thank you!

d-unsed commented 8 years ago

FYI @simon0191 969ef55f8a926536154faa10071c4679c7ca51b7...8b92dc46c24ce9bad2a4224a3806abd46b340c36