Backport of c19bbefca2 from master
c19bbefca2
This commit also added tests for LazyObject and refactored the testsuite of SimpleLazyObject so that it can share test cases with LazyObject.