vscode-tmgrammar-test icon indicating copy to clipboard operation
vscode-tmgrammar-test copied to clipboard

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

Open serkonda7 opened this issue 2 years ago • 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 avatar Apr 11 '22 07:04 serkonda7

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

PanAeon avatar Apr 13 '22 10:04 PanAeon

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.

serkonda7 avatar Apr 14 '22 12:04 serkonda7