Fixes line truncation in insert_lines statements at 4k

This includes a few fixes for insert_lines promises, where the lines get truncated at 4k. I've also included a basic acceptance test.

This change also includes a fix for SplitString, as it's used in one of the insertion functions. There's more to come for this file, but since it was brought up in help-cfengine, I think it's worth submitting as-is right now for review and possible inclusion.
What if `sp` points to index 0?