Commit c77da889 authored by David Faure's avatar David Faure
Browse files

Fix OpeningHours::simplifiedExpression not really being const

Reading the code I realized it was modifying the instance internally,
which isn't what one would expect from a const method.
parent 405c78dd
Pipeline #105636 passed with stage
in 38 seconds
......@@ -394,6 +394,8 @@ private Q_SLOTS:
QVERIFY(oh.error() != OpeningHours::SyntaxError);
QCOMPARE(oh.normalizedExpression(), expectedOutput);
QCOMPARE(oh.simplifiedExpression(), expectedSimplifiedOutput);
// verify that simplifiedExpression() doesn't alter `oh`
QCOMPARE(oh.normalizedExpression(), expectedOutput);
// verify the expressions we generate are parsed correctly as well
OpeningHours oh2(oh.normalizedExpression());
......@@ -432,8 +432,9 @@ QByteArray OpeningHours::normalizedExpression() const
QByteArray OpeningHours::simplifiedExpression() const
return normalizedExpression();
OpeningHours copy(normalizedExpression());
return copy.normalizedExpression();
QString OpeningHours::normalizedExpressionString() const
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment