trailing whitespace. patch does not apply

The fact that the patch does not apply is not related to the trailing whitespace.

The patch tries to remove the y and z lines, but z does not exist in the file you're trying to apply it to (c/text.txt).

Something like the following would apply :

diff --git a/test.txt b/test.txt
index 66455a1..1a0d96d 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,4 @@
 x
-y
\ No newline at end of file
+z
+p
+q
\ No newline at end of file