String path = jar + dir + "/" + file;
byte[] lua = bytesFromJar(path);
// compile in memory
InputStream is = new ByteArrayInputStream(lua);
Prototype p = LuaC.instance.compile(is, "@" + dir + "/" + file);
String actual = protoToString(p);
// load expected value from jar
byte[] luac = bytesFromJar(path + "c");
Prototype e = loadFromBytes(luac, file);
String expected = protoToString(e);
// compare results
assertEquals(expected, actual);
// dump into memory
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DumpState.dump(p, baos, false);
byte[] dumped = baos.toByteArray();
// re-undump
Prototype p2 = loadFromBytes(dumped, file);
String actual2 = protoToString(p2);
// compare again
assertEquals(actual, actual2);