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

Undesired scope is not detected #36

Open
serkonda7 opened this issue Apr 11, 2022 · 3 comments
Open

Undesired scope is not detected #36

serkonda7 opened this issue Apr 11, 2022 · 3 comments

Comments

@serkonda7
Copy link

Pattern:

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

Test:

    funvar := true
//  ^^^ - keyword

However the test passes.

@PanAeon PanAeon changed the title undesired scope produces false positive Undesired scope is not detected Apr 13, 2022
@PanAeon
Copy link
Owner

PanAeon commented Apr 13, 2022

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

@senyai
Copy link

senyai commented Apr 1, 2024

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

@PanAeon
Copy link
Owner

PanAeon commented Apr 8, 2024

@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

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

3 participants