Skip to content

Commit

Permalink
fix(test): unit test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prb28 committed Dec 24, 2019
1 parent 08befb6 commit e3c14c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/test/adapter.test.ts
Expand Up @@ -15,7 +15,7 @@ import { BreakpointManager, GdbBreakpoint } from '../breakpointManager';
import { DebugDisassembledFile } from '../debugDisassembled';
import { ExtensionState } from '../extension';

describe('Node Debug Adapter', () => {
describe.only('Node Debug Adapter', () => {
const PROJECT_ROOT = Path.join(__dirname, '..', '..').replace(/\\+/g, '/');
const DEBUG_ADAPTER = Path.join(PROJECT_ROOT, 'out', 'debugAdapter.js').replace(/\\+/g, '/');
const DATA_ROOT = Path.join(PROJECT_ROOT, 'test_files', 'debug').replace(/\\+/g, '/');
Expand Down
6 changes: 5 additions & 1 deletion src/test/adf.test.ts
Expand Up @@ -78,12 +78,13 @@ describe("ADFTools test", function () {
referenceBootBlock = Buffer.alloc(fileSizeInBytes);
let fd = fs.openSync(bootBlockFileName, 'r');
fs.readSync(fd, referenceBootBlock, 0, fileSizeInBytes, 0);

fs.closeSync(fd);
let croppedBootBlockFileName = path.join(__dirname, "..", "..", "test_files", "bootblock", "OS13Crop.bb");
fileSizeInBytes = fs.statSync(croppedBootBlockFileName).size;
binaryBootBlockData = Buffer.alloc(fileSizeInBytes);
fd = fs.openSync(croppedBootBlockFileName, 'r');
fs.readSync(fd, binaryBootBlockData, 0, fileSizeInBytes, 0);
fs.closeSync(fd);
});
it("Should compute a bootblock checksum", async function () {
expect(adfTools.calculateChecksum(referenceBootBlock)).to.be.equal(0xC0200F19);
Expand All @@ -100,7 +101,10 @@ describe("ADFTools test", function () {
let fileContents = Buffer.alloc(fileSizeInBytes);
let fd = fs.openSync(outputFile, 'r');
fs.readSync(fd, fileContents, 0, fileSizeInBytes, 0);
fs.closeSync(fd);
expect(fileContents).to.be.eql(referenceBootBlock);
fs.unlinkSync(outputFile);
fs.rmdirSync(tempDir);
});
});
});
5 changes: 5 additions & 0 deletions src/test/extension_symb.test.ts
Expand Up @@ -16,6 +16,11 @@ describe("Global Extension Tests", function () {
// Simple test file
const uri = vscode.Uri.file(Path.join(testFilesPath, "tutorial.s"));
before(async () => {
// activate the extension
let ext = vscode.extensions.getExtension('prb28.amiga-assembly');
if (ext) {
await ext.activate();
}
// Read the file
document = await vscode.workspace.openTextDocument(uri);
// tslint:disable-next-line:no-unused-expression
Expand Down

0 comments on commit e3c14c0

Please sign in to comment.