Add test for debug warning.
Allow dup() to copy trees as well.