Skip to content

Commit

Permalink
implement a test pattern for issue microsoft#145
Browse files Browse the repository at this point in the history
  • Loading branch information
msftrncs committed Jan 24, 2021
1 parent 7fe8ca7 commit 0906b05
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 0 deletions.
79 changes: 79 additions & 0 deletions test-cases/suite1/fixtures/infinite-loop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "infinite-loop-grammar",
"scopeName": "source.infinite-loop",
"patterns": [
{
"name": "start",
"begin": "\\A",
"end": "$",
"patterns": [
{
"name": "negative-look-ahead",
"match": "(?!a)"
}
]
},
{
"include": "#test"
},
{
"include": "#not_a_problem"
}
],
"repository": {
"test": {
"name": "test",
"begin": "(?=test)",
"end": "$",
"patterns": [
{
"include": "#test_this"
}
]
},
"test_this": {
"name": "test_this",
"begin": "(?=test this)",
"end": "$",
"patterns": [
{
"include": "#test_this_line"
}
]
},
"test_this_line": {
"name": "test_this_line",
"begin": "(?=test this line)",
"end": "$",
"patterns": [
{
"include": "#test"
}
]
},
"spaces":
{
"name": "spaces",
"begin": "^(?=\\s)",
"end": "(?=\\S)"
},
"not_a_problem":
{
"name": "not_a_problem",
"begin": "(?=not)",
"end": "\\z",
"patterns": [
{
"name": "not",
"match": "\\Gnot"
},
{
"include": "#not_a_problem"
},
{
"include": "#spaces"
}
]
}
}
}
96 changes: 96 additions & 0 deletions test-cases/suite1/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1710,5 +1710,101 @@
]
}
]
},
{
"grammars": [
"fixtures/infinite-loop.json"
],
"grammarPath": "fixtures/infinite-loop.json",
"desc": "Issue #145",
"lines": [
{
"line": "abc",
"tokens": [
{
"value": "a",
"scopes": [
"source.infinite-loop",
"start"
]
},
{
"value": "bc",
"scopes": [
"source.infinite-loop"
]
}
]
},
{
"line": "test this line",
"tokens": [
{
"value": "test this line",
"scopes": [
"source.infinite-loop",
"test",
"test_this",
"test_this_line"
]
}
]
},
{
"line": "not",
"tokens": [
{
"value": "not",
"scopes": [
"source.infinite-loop",
"test",
"test_this",
"test_this_line"
]
}
]
},
{
"line": " not",
"tokens": [
{
"value": " ",
"scopes": [
"source.infinite-loop"
]
},
{
"value": "not",
"scopes": [
"source.infinite-loop",
"not_a_problem",
"not"
]
}
]
},
{
"line": " not",
"tokens": [
{
"value": " ",
"scopes": [
"source.infinite-loop",
"not_a_problem",
"spaces"
]
},
{
"value": "not",
"scopes": [
"source.infinite-loop",
"not_a_problem",
"not_a_problem",
"not"
]
}
]
}
]
}
]

0 comments on commit 0906b05

Please sign in to comment.