Skip to content

Commit

Permalink
test: fix test on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsergio committed Apr 22, 2024
1 parent 05a4291 commit e3fd3be
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions out/qttest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export declare class QtTest {
get id(): string;
get label(): string;
relativeFilename(): string;
filenameWithoutExtension(): string;
/**
* Calls "./yourqttest -functions" and stores the results in the slots property.
*/
Expand Down
7 changes: 7 additions & 0 deletions out/qttest.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ class QtTest {
result = result.replace(/\\/g, "/");
return result;
}
/// returns filename without .exe extension
filenameWithoutExtension() {
let result = this.filename;
if (result.endsWith(".exe"))
result = result.slice(0, -4);
return result;
}
/**
* Calls "./yourqttest -functions" and stores the results in the slots property.
*/
Expand Down
2 changes: 1 addition & 1 deletion out/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function runTests(buildDirPath) {
console.error("Expected 1 executable, got " + executables.length);
process.exit(1);
}
if (!executables[0].filename.endsWith("test1")) {
if (!executables[0].filenameWithoutExtension().endsWith("test1")) {
console.error("Expected filename to end with test1");
process.exit(1);
}
Expand Down
9 changes: 9 additions & 0 deletions src/qttest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ export class QtTest {
return result;
}

/// returns filename without .exe extension
public filenameWithoutExtension() {
let result = this.filename;
if (result.endsWith(".exe"))
result = result.slice(0, -4);

return result;
}

/**
* Calls "./yourqttest -functions" and stores the results in the slots property.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async function runTests(buildDirPath: string) {
process.exit(1);
}

if (!executables[0].filename.endsWith("test1")) {
if (!executables[0].filenameWithoutExtension().endsWith("test1")) {
console.error("Expected filename to end with test1");
process.exit(1);
}
Expand Down

0 comments on commit e3fd3be

Please sign in to comment.