diff options
| author | Joerg Bornemann <joerg.bornemann@qt.io> | 2025-12-03 17:19:36 +0100 |
|---|---|---|
| committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2025-12-05 09:33:24 +0000 |
| commit | 0213275ac075b8684eb518e584379dfbdc6b2b79 (patch) | |
| tree | 09fb5cbf80faa023970e626ff64098ffc37abe26 /tests | |
| parent | 15a734c8dce3ae7db57a956c54e77340bf3bfdec (diff) | |
Preprocessor conditionals like
!if condition1
...
!else if condition2
...
!else
...
!endif
Were not recognized.
Now, we handle "!else if" as "!elseif". Same for !elseifdef and
!elseifndef.
Fixes: QTCREATORBUG-32129
Change-Id: I2e5e22deeec18650aed245fd32c16bbc6025fc10
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/makefiles/conditionals.mk | 28 | ||||
| -rw-r--r-- | tests/tests.cpp | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/makefiles/conditionals.mk b/tests/makefiles/conditionals.mk index a783e60..aecd32a 100644 --- a/tests/makefiles/conditionals.mk +++ b/tests/makefiles/conditionals.mk @@ -93,5 +93,33 @@ boo \ hoo !ENDIF +# Test !else if syntax (alternative to !elseif with space) +TEST11=false +!if "A" == "B" +TEST11=false +!else if "A"=="A" +TEST11=true +!else +TEST11=false +!endif + +TEST12=false +!ifdef NOT_DEFINED +TEST12=false +!else ifdef TEST1 +TEST12=true +!else +TEST12=false +!endif + +TEST13=false +!ifdef NOT_DEFINED +TEST13=false +!else ifndef NOT_DEFINED +TEST13=true +!else +TEST13=false +!endif + all: diff --git a/tests/tests.cpp b/tests/tests.cpp index 21e1df6..f1c3fe3 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -333,6 +333,9 @@ void Tests::conditionals() QCOMPARE(macroTable->macroValue("TEST8"), QLatin1String("true")); QCOMPARE(macroTable->macroValue("TEST9"), QLatin1String("foo bar baz")); QCOMPARE(macroTable->macroValue("TEST10"), QLatin1String("foo bar boo hoo")); + QCOMPARE(macroTable->macroValue("TEST11"), QLatin1String("true")); + QCOMPARE(macroTable->macroValue("TEST12"), QLatin1String("true")); + QCOMPARE(macroTable->macroValue("TEST13"), QLatin1String("true")); } void Tests::dotDirectives() |
