Expected Behavior of FFT
Zero-padding is used to compute longer FFT, in your case the signal is padded to be power of 2. In fact, there is no need to do so, there are FFT available using different lengths (also prime ones).

The zero-padding does not introduce new data, does not change sampling frequency of the original signal, it just interpolates the values. In your example there are 5 points, padding them to 8 introduces additional result bins that are closer to each other - this makes particular frequency bin shift, which is stored in the phase component of the result.

So the most probably your FFT is fine, just the test changes the distance between frequency bins, but this step is not included in reading phase, so the test is faulty.