Fix bug 3495802 to return correct offset of substrings from string.find()

This commit is contained in:
James Roseborough
2013-01-27 16:14:03 +00:00
parent 8a5e811c7f
commit 1f89f30239
3 changed files with 13 additions and 3 deletions

View File

@@ -560,5 +560,14 @@ public class FragmentsTest extends TestSuite {
runFragment( LuaValue.varargsOf(LuaValue.FALSE, LuaValue.NIL),
"return pcall(error)\n");
}
public void testFindWithOffset() {
runFragment(LuaValue.varargsOf(LuaValue.valueOf(8), LuaValue.valueOf(5)),
"string = \"abcdef:ghi\"\n" +
"substring = string:sub(3)\n" +
"idx = substring:find(\":\")\n" +
"return #substring, idx\n");
}
}
}