Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test.sl doesn't work from the test directory #5

Open
acook opened this issue Feb 9, 2013 · 4 comments
Open

test.sl doesn't work from the test directory #5

acook opened this issue Feb 9, 2013 · 4 comments

Comments

@acook
Copy link

acook commented Feb 9, 2013

Given: slash-cli is compiled and you have the slash source code

When: You're in the slash/test directory
And: You run slash-cli test.sl core/array.sl
Then: You see this error:

NameError: Undefined constant 'Test' in Object
  at <main> in /Users/acook/Pork/slash/test/test.sl, line 3
  at <main> in test.sl, line 3

However

When: You're in the slash root source directory
And: You run slash-cli test/test.sl test/core/array.sl
Then: Tests are run successfully with this output:

...................

Tests finished. 19 passes, 0 failures, 182 assertions.

That seems weird to me. I can't figure out why just from looking at the source code either.

@haileys
Copy link
Contributor

haileys commented Feb 9, 2013

. 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?

@acook
Copy link
Author

acook commented Feb 9, 2013

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.

@haileys
Copy link
Contributor

haileys commented Feb 9, 2013

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.

@acook
Copy link
Author

acook commented Feb 9, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants