What is this strange-shaped fruit?
Now I have the answer, and if you are reading this soon after eating the fruit you should probably seek medical attention.

Looks like Cascabela theviata which is in the Apocynaceae and the Wikipedia article makes clear that the fruit is also poisonous.