-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
143 changed files
with
3,574 additions
and
999 deletions.
There are no files selected for viewing
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
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
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,33 @@ | ||
import { IDL_COMMANDS } from '@idl/shared'; | ||
import expect from 'expect'; | ||
import * as vscode from 'vscode'; | ||
|
||
import { RunnerFunction } from '../runner.interface'; | ||
|
||
/** | ||
* Function that verifies that our queueing works right | ||
*/ | ||
export const QueueRight: RunnerFunction = async (init) => { | ||
/** | ||
* Start IDL | ||
*/ | ||
const started = await vscode.commands.executeCommand( | ||
IDL_COMMANDS.DEBUG.START | ||
); | ||
|
||
// verify we started | ||
expect(started).toBeTruthy(); | ||
|
||
/** | ||
* Execute two commands at once | ||
*/ | ||
const p1 = init.debug.adapter.evaluate(`wait, 1`); | ||
const p2 = init.debug.adapter.evaluate(`wait, 1`); | ||
|
||
// wait for everything to finish | ||
await Promise.all([p1, p2]); | ||
|
||
// make sure the outputs are the same | ||
expect((await p1).trim()).toEqual(''); | ||
expect((await p2).trim()).toEqual(''); | ||
}; |
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,136 @@ | ||
import { GetExtensionPath, IDL_COMMANDS, Sleep } from '@idl/shared'; | ||
import { OpenFileInVSCode } from '@idl/vscode/shared'; | ||
import expect from 'expect'; | ||
import * as vscode from 'vscode'; | ||
|
||
import { RunnerFunction } from '../runner.interface'; | ||
|
||
/** | ||
* Track the files we need to run | ||
*/ | ||
const TO_RUN: { file: string; result: boolean }[] = [ | ||
/** | ||
* Main level tests | ||
*/ | ||
{ | ||
file: GetExtensionPath('idl/test/client-e2e/debug/run-file/main.pro'), | ||
result: true, | ||
}, | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/syntax_error.pro' | ||
), | ||
result: false, | ||
}, | ||
|
||
/** | ||
* Procedure tests | ||
*/ | ||
{ | ||
file: GetExtensionPath('idl/test/client-e2e/debug/run-file/procedure.pro'), | ||
result: true, | ||
}, | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/procedure_with_main.pro' | ||
), | ||
result: true, | ||
}, | ||
|
||
/** | ||
* Function tests | ||
*/ | ||
{ | ||
file: GetExtensionPath('idl/test/client-e2e/debug/run-file/function.pro'), | ||
result: true, | ||
}, | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/function_with_main.pro' | ||
), | ||
result: true, | ||
}, | ||
|
||
/** | ||
* When our file doesnt match routine name we dont care | ||
*/ | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/name mismatch.pro' | ||
), | ||
result: true, | ||
}, | ||
|
||
/** | ||
* Procedure method tests | ||
*/ | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/procedure_method.pro' | ||
), | ||
result: false, | ||
}, | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/procedure_method_with_main.pro' | ||
), | ||
result: true, | ||
}, | ||
|
||
/** | ||
* Function method tests | ||
*/ | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/function_method.pro' | ||
), | ||
result: false, | ||
}, | ||
{ | ||
file: GetExtensionPath( | ||
'idl/test/client-e2e/debug/run-file/function_method_with_main.pro' | ||
), | ||
result: true, | ||
}, | ||
]; | ||
|
||
/** | ||
* Function that verifies all of our cases for running files | ||
*/ | ||
export const RunFile: RunnerFunction = async (init) => { | ||
/** | ||
* Start IDL | ||
*/ | ||
const started = await vscode.commands.executeCommand( | ||
IDL_COMMANDS.DEBUG.START | ||
); | ||
|
||
// verify we started | ||
expect(started).toBeTruthy(); | ||
|
||
// close | ||
await vscode.commands.executeCommand('workbench.action.closeAllEditors'); | ||
|
||
// process each case | ||
for (let i = 0; i < TO_RUN.length; i++) { | ||
console.log(` Processing file: "${TO_RUN[i].file}"`); | ||
// open file | ||
await OpenFileInVSCode(TO_RUN[i].file, true); | ||
|
||
// short pause | ||
await Sleep(100); | ||
|
||
// run | ||
const res = await vscode.commands.executeCommand(IDL_COMMANDS.DEBUG.RUN); | ||
|
||
// verify result | ||
if (TO_RUN[i].result) { | ||
expect(res).toBeTruthy(); | ||
} else { | ||
expect(res).toBeFalsy(); | ||
} | ||
|
||
// close | ||
await vscode.commands.executeCommand('workbench.action.closeAllEditors'); | ||
} | ||
}; |
95 changes: 95 additions & 0 deletions
95
apps/client-e2e/src/tests/debugging/syntax_error_tracking.ts
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,95 @@ | ||
import { GetExtensionPath, IDL_COMMANDS } from '@idl/shared'; | ||
import { Sleep } from '@idl/tests/helpers'; | ||
import { OpenFileInVSCode, ReplaceDocumentContent } from '@idl/vscode/shared'; | ||
import expect from 'expect'; | ||
import * as vscode from 'vscode'; | ||
|
||
import { RunnerFunction } from '../runner.interface'; | ||
|
||
/** | ||
* Correct text that we can compile without syntax errors | ||
*/ | ||
const VALID_TEXT = ` | ||
compile_opt idl2 | ||
print, 42 | ||
end | ||
`; | ||
|
||
/** | ||
* Function that verifies we can track syntax errors | ||
*/ | ||
export const SyntaxErrorTracking: RunnerFunction = async (init) => { | ||
/** | ||
* Start IDL | ||
*/ | ||
const started = await vscode.commands.executeCommand( | ||
IDL_COMMANDS.DEBUG.START | ||
); | ||
|
||
// verify we started | ||
expect(started).toBeTruthy(); | ||
|
||
// open file | ||
const doc = await OpenFileInVSCode( | ||
GetExtensionPath('idl/test/client-e2e/debug/compile_error.pro') | ||
); | ||
|
||
/** Get original text */ | ||
const orig = doc.getText(); | ||
|
||
// short pause to make sure we open and parse | ||
await Sleep(100); | ||
|
||
// verify problems | ||
expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(0); | ||
|
||
/** | ||
* Compile and make sure we report an error | ||
* ********************************************************************** | ||
*/ | ||
|
||
// compile | ||
await vscode.commands.executeCommand(IDL_COMMANDS.DEBUG.COMPILE); | ||
|
||
// short pause to make sure we open and parse | ||
await Sleep(100); | ||
|
||
// verify problems | ||
expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(1); | ||
|
||
/** | ||
* Fix syntax error and make sure no syntax errors | ||
* ********************************************************************** | ||
*/ | ||
|
||
// replace the content in our document | ||
await ReplaceDocumentContent(doc, VALID_TEXT); | ||
|
||
// compile | ||
await vscode.commands.executeCommand(IDL_COMMANDS.DEBUG.COMPILE); | ||
|
||
// short pause to make sure we open and parse | ||
await Sleep(100); | ||
|
||
// verify problems | ||
expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(0); | ||
|
||
/** | ||
* Go back to the original content and make sure we have the same errors | ||
* ********************************************************************** | ||
*/ | ||
|
||
// replace the content in our document | ||
await ReplaceDocumentContent(doc, orig); | ||
|
||
// compile | ||
await vscode.commands.executeCommand(IDL_COMMANDS.DEBUG.COMPILE); | ||
|
||
// short pause to make sure we open and parse | ||
await Sleep(100); | ||
|
||
// verify problems | ||
expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(1); | ||
}; |
Oops, something went wrong.