Add code to handle when the test expression is neither true nor false.

Closes PR 14564.