TestInsight-enabled project fails to compile after renaming a unit

Issue #147 invalid
Diego Sogari created an issue

Renaming a unit in a TestInsight-enabled project messes up with the project source file (.dpr). The {$IFNDEF TESTINSIGHT} directive just before the block of local variable declarations is removed from the file, which makes compilation fail due to a missing match for the next {$ENDIF}. Also, any referenced unit after the DUnitX.Loggers.Console up until the next {$ENDIF } directive also gets removed. Normally, this will be a reference to DUnitX.Loggers.Xml.NUnit.

Steps to reproduce:

  1. Create a new DUnitX project in RAD Studio and compile it to verify that it works
  2. Rename the Unit1 to something else and check that it still compiles
  3. Enable TestInsight for the project and check that it still compiles
  4. Rename the unit again and try to compile the project
  5. Compilation will fail due to the reasons described above

I’m using Delphi 10.4 Version 27.0.38860.1461 on Windows 64-bit

Comments (1)

  1. Stefan Glienke repo owner

    That's not an issue of TestInsight but one of the IDE as it does not properly parse the dpr but uses some rather simplistic logic when it modifies it. Putting conditional defines into a dpr is never a good idea - the DUnitX template should work different by putting such code into a pas.

  2. Log in to comment