tests: fix build on Windows
core: fix processing 'if' at loop end