Skip to content

Commit

Permalink
CI: Test with ubuntu-latest and newer Qt 5.15
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Aug 23, 2023
1 parent e7f0a99 commit af16898
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ jobs:
compiler_package: clang
with_qt6: false

- os: ubuntu-latest
buildname: Linux-latest
build_type: Debug
compiler: g++
compiler_package: g++
with_qt6: false

- os: ubuntu-latest
buildname: Qt 6
build_type: Debug
Expand Down
16 changes: 15 additions & 1 deletion src/scriptable/scriptable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,21 @@ struct ScriptValueFactory<QRegularExpression> {
const auto variant = value.toVariant();
return variant.toRegularExpression();
#else
const QString pattern = toString(value.property("source"));
QString pattern = toString(value.property("source"));

// Unescape slash characters in JS regex pattern: \/ -> /
bool escape = false;
for (int i = 0; i < pattern.size(); ++i) {
const QChar &c = pattern[i];
if (escape && c == '/') {
i -= 1;
pattern.remove(i, 1);
escape = false;
} else {
escape = !escape && c == '\\';
}
}

return pattern == QStringLiteral("(?:)")
? QRegularExpression()
: QRegularExpression(pattern);
Expand Down
6 changes: 3 additions & 3 deletions src/tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ void Tests::commandsAddCommandsRegExp()
{
const QString commands =
"[Command]\n"
"Match=^(https?|ftps?)://\n";
"Match=^(https?|ftps?)://\\\\$\n";

// Ensure there is a basic RegExp support.
RUN("/test/", "/test/\n");
Expand All @@ -1720,15 +1720,15 @@ void Tests::commandsAddCommandsRegExp()
RUN("eval" << "exportCommands(importCommands(arguments[1]))" << "--" << commands, commands);
RUN("eval" << "Object.prototype.toString.call(importCommands(arguments[1])[0].re)" << "--" << commands, "[object RegExp]\n");
RUN("eval" << "Object.prototype.toString.call(importCommands(arguments[1])[0].wndre)" << "--" << commands, "[object RegExp]\n");
RUN("eval" << "importCommands(arguments[1])[0].re" << "--" << commands, "/^(https?|ftps?):\\/\\//\n");
RUN("eval" << "importCommands(arguments[1])[0].re" << "--" << commands, "/^(https?|ftps?):\\/\\/\\$/\n");
RUN("eval" << "importCommands(arguments[1])[0].wndre" << "--" << commands, "/(?:)/\n");

RUN("eval" << "addCommands(importCommands(arguments[1]))" << "--" << commands, "");
RUN("keys" << commandDialogListId << "Enter" << clipboardBrowserId, "");

RUN("exportCommands(commands())", commands);
RUN("commands()[0].name", "\n");
RUN("commands()[0].re", "/^(https?|ftps?):\\/\\//\n");
RUN("commands()[0].re", "/^(https?|ftps?):\\/\\/\\$/\n");
RUN("commands()[0].wndre", "/(?:)/\n");
}

Expand Down
2 changes: 0 additions & 2 deletions utils/github/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ if [[ $WITH_QT6 == true ]]; then
)
else
qt_packages=(
qt5-default

qtbase5-private-dev
qtdeclarative5-dev
qttools5-dev
Expand Down

0 comments on commit af16898

Please sign in to comment.