Open acook opened 11 years ago
.
is in INC
by default. I'd like to keep it this way for ease of use, but then you run into issues like this.
I think the best way to solve this would be to put .
at the end of INC
. Thoughts?
Ruby 1.9 deals with a similar problem by requiring ./
at the beginning of require
statements that aren't in the path:
require './test'
I think its a pretty solid approach. You shouldn't have to choose between your files and your standard library.
Yeah it works well for Ruby, but not so much for the use case Slash is designed for IMO.
Also, Slash has explicit require but I want to emphasize use Foo::Bar;
syntax which doesn't let you specify a full path.
Ah, I see, you want autodiscovery of classes. That's actually a more interesting goal.
In that case, you should probably just rename the file to run_test.sl
, and establish a convention of avoiding reserved names.
Another option, would be to ignore the current file when doing a lookup, and you might want to do that anyway, but I still think renaming the file is in order.
Given: slash-cli is compiled and you have the slash source code
When: You're in the
slash/test
directory And: You runslash-cli test.sl core/array.sl
Then: You see this error:However
When: You're in the
slash
root source directory And: You runslash-cli test/test.sl test/core/array.sl
Then: Tests are run successfully with this output:That seems weird to me. I can't figure out why just from looking at the source code either.