lunarmodules / busted

Elegant Lua unit testing.
https://lunarmodules.github.io/busted/
MIT License
1.4k stars 185 forks source link

Update terra loader to use the global-injection of current Terra #606

Closed aiverson closed 4 years ago

aiverson commented 5 years ago

A quick and simple fix to allow testing code from the latest version of terra rather than a four year old alpha build. Currently working.

Further revisions to come after changing terra to provide a requirable module to scripts running inside it that matches the library requireable from outside terra so that require "terra" will work.

That would allow using busted regardless of running it from the terra executable or luajit.

aiverson commented 5 years ago

That should send out error messages when trying to load a terra file without terra available.

Should it be sending error messages when the module is loaded instead? And should it be reporting the error by publishing it, or by calling error?

aiverson commented 5 years ago

Any comments on this? Can it be merged?

DorianGray commented 5 years ago

This looks good to me, but I don't remember enough to know whether error handling works properly in the file loaders. I think it does, and it would be nice to have less places for errors to be published. @Tieske did you have any more feedback?

aiverson commented 5 years ago

If you have a better idea for how to report an error, I'd love to hear it.

Tieske commented 5 years ago

did you have any more feedback?

No

DorianGray commented 5 years ago

@aiverson can you just error()? If not let me know and we'll get this merged.

aiverson commented 5 years ago

I don't know. This seemed to be how Busted was reporting errors in a number of other places. I'll go experiment on what the difference between just calling error and publishing the error.

Tieske commented 5 years ago

It relates to this: https://github.com/Olivine-Labs/busted/pull/577

trying to load terra files without terra should be a hard error similar to the LuaCov issue

aiverson commented 5 years ago

There?