If you are using eg <: AbstractArray, you can implement a wrapper type that forwards methods for everything except setindex!. This will protect you from bugs in pure Julia, but not from direct memory manipulation (bugs or intentional, implemented in Julia or in a foreign library).
You can make a copy and compare for unit testing. I sometimes do this when I refactor code from mutating to non-mutating (and lament my tendency for premature optimization).