silverqx / TinyORM

Modern C++ ORM library
https://www.tinyorm.org
MIT License
242 stars 25 forks source link

Tests don't compile if ORM is disabled #16

Closed SchaichAlonso closed 1 year ago

SchaichAlonso commented 1 year ago

The querybuilders' unit tests fail to compile if ORM compilation is disabled via cmake

PS D:\projects\TinyORM> git reflog -n 1
    1cc4dd18 (HEAD -> main, origin/main, origin/develop, origin/HEAD) HEAD@{0}: pull: Fast-forward
PS D:\projects\TinyORM> cmake -B build -DORM=off -DBUILD_TESTS=on "-DCMAKE_TOOLCHAIN_FILE=d:/vcpkg/scripts/buildsystems/vcpkg.cmake" .
PS D:\projects\TinyORM> cmake --build build
    [...]
D:\Projects\TinyORM\tests\auto\unit\orm\schema\mysql_schemabuilder\tst_mysql_schemabuilder.cpp(31,24): error C2039: 'LogicError': is not a member of 'Orm::Exceptions' [D:\Projects\TinyORM\build\tests\auto\unit\orm\schema\mysql_schemabuilder\mysql_schemabuilder.vcxproj]
D:\Projects\TinyORM\include\orm/exceptions/queryerror.hpp(16,11): message : see declaration of 'Orm::Exceptions' [D:\Projects\TinyORM\build\tests\auto\unit\orm\schema\mysql_schemabuilder\mysql_schemabuilder.vcxproj]
D:\Projects\TinyORM\tests\auto\unit\orm\schema\mysql_schemabuilder\tst_mysql_schemabuilder.cpp(31,1): error C2873: 'LogicError': symbol cannot be used in a using-declaration [D:\Projects\TinyORM\build\tests\auto\unit\orm\schema\mysql_schemabuilder\mysql_schemabuilder.vcxproj]
D:\Projects\TinyORM\tests\auto\unit\orm\schema\mysql_schemabuilder\tst_mysql_schemabuilder.cpp(828,5): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Projects\TinyORM\build\tests\auto\unit\orm\schema\mysql_schemabuilder\mysql_schemabuilder.vcxproj]
D:\Projects\TinyORM\tests\auto\unit\orm\schema\mysql_schemabuilder\tst_mysql_schemabuilder.cpp(828,5): error C2143: syntax error: missing ',' before '&' [D:\Projects\TinyORM\build\tests\auto\unit\orm\schema\mysql_schemabuilder\mysql_schemabuilder.vcxproj]

build attempt was done on windows using SDK 10.0.19041.0 and vcpkg fba81a6a5 which is the same as the current github actions use, though it also reproduces on very different platforms.

The missing exceptions are actually being built as part of the querybuilder. The problem instead is that the tests deep-end on models/user.hpp to include the header files for the exception classes they are using, but the corresponding include directive is skipped for builds that disable ORM.

silverqx commented 1 year ago

The problem is that currently, we don't have any GitHub action with disabled ORM and I personally don't compile with disabled ORM too often, last time it was a few months ago.

Thank you for the report, it will be fixed in the next release.

silverqx commented 1 year ago

Merged, thank you

silverqx commented 1 year ago

The fix is already in the main branch, it should be fine now.