:: Article Deprecated!

:: The issue mentioned in this article has been fixed in F4 v1.1.

:: Article Deprecated!

F4 Logo F4 by Xored is an awesome IDE for Fantom, I use it every day - but it does have it's quirks...

The Problem

For instance, let's say I've just written a new feature for a library:

  • I have a test for it.
  • I run it in the F4 Unit Test view.
  • It passes.
  • I meddle with the code, run the test again, it passes.
  • I refactor some more and notice an obvious breaking change.
  • I run the test.
  • It still passes.

Confused!

I purposesly fail() the test... and it still goes GREEN!???

F4 Tests Passing

Grrr...

What's Going On?

In short, I had a compilation failure somewhere in the code.

In long, this is how F4 works...

When you save a source file in F4, it builds your pod into a work dir, usually, %PROJ_HOME%/bin/fan/lib/fan. (Note the /bin/ portion is defined by the Java default output folder in project properties.)

When you run tests in the F4 Unit Test view, it runs them from the compiled pod.

Sounds good. But if your code has a compilation error the process goes wrong...

The compilation error prevents a new pod from being built... fair enough. But the old pod still exists. So when you now run the tests, they run against the old pod. And in that pod, the tests pass!

The Solution

Keep an eye on the Problems view and if it looks anything like this:

F4 Tests Passing

Don't do anything until you fix it!

This may look and seem obvious but when coding on a laptop, I usually have the views minimised to save on screen real estate.

Note that this effects more than just tests. Any code you want to run from the pod won't have the desired effect until you fix the compilation errors.

Cool, now you know, you can code happily in your favourite F4 IDE!

Have fun!

Edits:

  • 18 Aug 2016 - Deprecated.

Discuss