Add tests of substr lens
Code sharing