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

Undesired scope is not detected

Open serkonda7 opened this issue 2 years ago • 3 comments

Pattern:

{
	"name": "keyword",
	"match": "fun"
}

Test:

    funvar := true
//  ^^^ - keyword

However the test passes.

serkonda7 avatar Apr 11 '22 07:04 serkonda7

@serkonda7, could you generate a snapshot file with a vscode-tmgrammar-snap (just use it instead of vscode-tmgrammar-test) and post it here?

PanAeon avatar Apr 13 '22 11:04 PanAeon

@PanAeon Let me ask serkonda7 question differently. Let's say we have this successful test:

    funvar := true
//  ^^^^^^ - keyword

how should I test that keyword is not matching a space after 'funvar'? If I add a negative match after each check, that will make tests hard to write. I think there should be a test mode to match exactly. Or a special syntax:

//  ^^^^^^ - !keyword

match keyword here and nowhere else. Thanks for the plugin, very useful.

senyai avatar Apr 01 '24 18:04 senyai

@senyai Well, I guess you are right. My idea was to actually add negative check afterwards. You can try snapshot tests if you need strict tests right now. I believe they are matching exactly

PanAeon avatar Apr 08 '24 09:04 PanAeon