Skip to content

Commit

Permalink
Merge pull request #616 from KoeMai/develop
Browse files Browse the repository at this point in the history
Fix bug #601 Problem with CMake:Execute current target without debugger
  • Loading branch information
no-realm authored Apr 4, 2019
2 parents 8fefa74 + 7bb0dea commit 26f1519
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cmake-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
};
if (process.platform == 'win32') {
// Use cmd.exe on Windows
termOptions.shellPath = 'C:/Windows/System32/cmd.exe';
termOptions.shellPath = 'C:\\Windows\\System32\\cmd.exe';
}
if (!this._launchTerminal)
this._launchTerminal = vscode.window.createTerminal(termOptions);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <cstdlib>

#ifndef _CMAKE_VERSION
#define _CMAKE_VERSION "0.0"
Expand Down Expand Up @@ -29,4 +30,9 @@ int main(int, char**) {
std::cout << " \"build-env\": \"" << get_env_var("_BUILD_ENV") << "\",\n";
std::cout << " \"env\": \"" << get_env_var("_ENV") << "\"\n";
std::cout << "}\n";

std::ofstream ofs ("test.txt", std::ofstream::out);
ofs << "{\n";
ofs << " \"cookie\": \"" CMT_COOKIE "\",\n";
ofs << "}\n";
}
30 changes: 29 additions & 1 deletion test/extension-tests/successful-build/test/debugger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,32 @@ suite('[Debug/Lauch interface]', async () => {
// Check that it is compiled as a new file
expect(fs.existsSync(validPath)).to.be.false;
}).timeout(60000);
});

test('Test launch target', async () => {
testEnv.config.updatePartial({buildBeforeRun: false});

const executablesTargets = await cmt.executableTargets;
expect(executablesTargets.length).to.be.not.eq(0);
await cmt.setLaunchTargetByName(executablesTargets[0].name);

const launchProgrammPath = await cmt.launchTargetPath();
expect(launchProgrammPath).to.be.not.null;

// Remove file if not exists
const createdFileOnExecution = path.join(testEnv.projectFolder.location, 'test.txt');
if (fs.existsSync(createdFileOnExecution)) {
fs.unlinkSync(createdFileOnExecution);
}

const terminal = await cmt.launchTarget();
expect(terminal).of.be.not.null;
expect(terminal!.name).of.be.eq('CMake/Launch');

// Needed to get launch target result
await new Promise(res => setTimeout(res, 3000));

// Check that it is compiled as a new file
expect(fs.existsSync(createdFileOnExecution)).to.be.true;
}).timeout(60000);
});

0 comments on commit 26f1519

Please sign in to comment.