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

Tests for error cases #16

Closed
jamesfoster opened this issue Apr 27, 2010 · 6 comments
Closed

Tests for error cases #16

jamesfoster opened this issue Apr 27, 2010 · 6 comments

Comments

@jamesfoster
Copy link
Contributor

I'd love to see some tests to ensure the correct error is raised when invalid less is parsed.

@cloudhead
Copy link
Member

Yea, I have yet to stabilize the error system. I didn't spend much time on it yet—but when I do, which is one of the priorities, I'll make sure it's all tested to the best of my abilities.

@jamesfoster
Copy link
Contributor Author

Now that you've put quite a bit of work into the error side of things when will you be adding tests for the errors? I'm trying to keep up but it's difficult without anything concrete to test against.

I've added a few tests for some of the more obvious error cases. Here's a couple:

http://github.com/jamesfoster/dotless/blob/master/src/dotless.Test/Specs/MixinsFixture.cs#L788

AssertError takes 5 arguments, the error message, the line, the line number and (zero based) column of the error and finally the input which generates the error.

I swap out the default stylizer for a simplified one which just outputs the relavant info for testing.

http://github.com/jamesfoster/dotless/blob/master/src/dotless.Test/TestStylizer.cs

Let me know what you think and I look forward to seeing what you come up with.

@jamesfoster
Copy link
Contributor Author

I like the call property you added to the error. very nice.

what happens when there is an error in an argument tho? the arguments index is at the call site already.

.mixin(@a: 5px) { width: @a; }
.class {
  .mixin( 10px / 0 );
}

I'm guessing it would say there's an error on line 2 which was called from line 2?

@cloudhead
Copy link
Member

yea, there's still some issues. Syntax errors also sometimes show up in the wrong place. I need to really take a day to improve the error messages throughout.

@jamesfoster
Copy link
Contributor Author

without following it through completely it looks like you're trying to get this call thing to work across imports, so that if you call an imported mixin passing arguments which causes it to fail it will tell you the file where the error occurred (the import) and the file where the mixin was called from (the main file).

but it seems as tho you're just passing the same context object around so it would output the same file name twice?

Surely you would need to not only store the index of the mixin but also the filename? unless i'm missing something?

@lukeapage
Copy link
Member

There is now the structure for some tests for errors, which I will expand soon..

SomMeri added a commit that referenced this issue Jan 21, 2014
Don't lint source-map since its owned by another project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants