The test would be:
(= x y)
That's the expression that actually returns a boolean value, and the behaviour of the if
conditional expression depends on it - if it's #t
(or in general: any non-false value) the consequent part will be executed: 0
. Only if it's #f
the alternative part will be executed: (+ x (foo (+ x 1) y))
.