tomaka / hlua

Rust library to interface with Lua
MIT License
507 stars 48 forks source link

`tests/misc.rs` doesn't test anything useful #127

Closed jonas-schievink closed 7 years ago

jonas-schievink commented 7 years ago

The only test inside does this (it's marked #[should_panic]):

let mut lua = Lua::new();
let file = File::open(&Path::new("/path/to/unexisting/file")).unwrap();
let _res: () = lua.execute_from_reader(file).unwrap();

The second line will always panic (since the file indeed does not exist), so the execute_from_reader call is never reached.

The test probably should implement a simple struct that is Read and always returns an error when something tries to read from it.

I'm also wondering why this isn't a unit test. There doesn't seem to be a good reason.