That's exactly what the
uniq command is made for:
uniq - report or omit repeated lines
uniq [OPTION]... [INPUT [OUTPUT]]
Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT
(or standard output).
With no options, matching lines are merged to the first occurrence.
$ uniq test.txt
Alternatively, you can use this sed one-liner 69. Delete duplicate, consecutive lines from a file (emulates "uniq") from Sed One-Liners Explained, Part III: Selective Deletion of Certain Lines and Special Applications
sed '$!N; /^\(.*\)\n\1$/!P; D' test.txt
which might be preferred if you want to edit
test.txt in place (by adding the