Add testcases for many already fixed bugs.

Closes PR11901.
Closes PR11972.
Closes PR12022.
Closes PR12224.
Closes PR12506.
Closes PR12533.
Closes PR12596.
Closes PR13198.
Closes PR13418.

Already fixed bugs, with existing testcases.
Closes PR12529.
Closes PR12631.
Closes PR12970.