PanAeon/vscode-tmgrammar-test

Assertion doesn't raise an error when it goes over the length of the tested string

Opened this issue · 2 comments

Consider the following pattern

{
	"name": "string",
	"begin": "'",
	"end": "'"
}

which is tested by this code:

fun main() {
    s:='my string'
//               ^^^^^^^^^^^^^ string
}

The test passes as the first ^ matches the tokens scope.

However I expect the test to fail, as all the following do not match.

@serkonda7, thank you for reporting this bug.

First of all, a "false positive" has a well defined meaning in the computer science. According to wikipedia: "A false positive is an error in binary classification in which a test result incorrectly indicates the presence of a condition (incorrect scope in our case)". In other words a false positive for the grammar test would be reporting errors when the test should pass clean.

I think something like "A test misses lots of required scopes" conveys meaning much better.

Well, I can replicate the behavior but only when ^ are going over the length of the previous string. Is this matches your findings?

Well, I can replicate the behavior but only when ^ are going over the length of the previous string. Is this matches your findings?

Yes, that's what I have observed.