-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#27 Semantic highlighting test added
- Loading branch information
1 parent
2209487
commit 1fe7ce2
Showing
10 changed files
with
1,223 additions
and
52 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as vscode from "vscode"; | ||
import * as assert from "assert"; | ||
import * as fs from 'fs'; | ||
import { getDocUri, getDocPath, activate } from "./helper"; | ||
|
||
suite("Semantic Highlighting", () => { | ||
const docUri = getDocUri("semanticHighlighting.eo"); | ||
|
||
test("Performs semantic highlighting in document", async () => { | ||
const targetTokens = fs.readFileSync(getDocPath("semanticHighlightingTarget.txt"),"utf8"); | ||
const targetTokensArray = targetTokens.split("\n"); | ||
|
||
await testSemanticHighlight(docUri, targetTokensArray); | ||
}); | ||
}); | ||
|
||
/** | ||
* Checks if the semantic tokens returned by the Semantic Tokens Provider | ||
* are exactly the same as expected | ||
* @param docUri | ||
* @param expectedCompletionList | ||
*/ | ||
async function testSemanticHighlight( | ||
docUri: vscode.Uri, | ||
expectedSemanticTokens: string[] | ||
) { | ||
await activate(docUri); | ||
|
||
const actualSemanticTokens = (await vscode.commands.executeCommand( | ||
"vscode.provideDocumentSemanticTokens", | ||
docUri | ||
)) as vscode.SemanticTokens; | ||
|
||
assert.ok(actualSemanticTokens.data.length >= 2); | ||
expectedSemanticTokens.forEach((expectedItem, i) => { | ||
const actualItem = actualSemanticTokens.data[i].toString(); | ||
assert.equal(expectedItem, actualItem); | ||
}); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[args...] > app | ||
memory 0 > x | ||
seq > @ | ||
x.write 2 | ||
while. | ||
x.lt 6 | ||
[i] | ||
seq > @ | ||
QQ.io.stdout | ||
QQ.txt.sprintf | ||
"%d x %d = %d\n" | ||
x | ||
x | ||
x.times x | ||
x.write | ||
x.plus 1 | ||
TRUE |
Oops, something went wrong.