Make writing List fields on Streamables possible from ActionScript again, and fix List reading and
writing in the code generated by GenActionScriptStreamableTask. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6199 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -22,8 +22,10 @@ package com.threerings.io;
|
||||
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class ASStreamableSubset extends SimpleStreamableObject
|
||||
{
|
||||
@@ -47,6 +49,9 @@ public class ASStreamableSubset extends SimpleStreamableObject
|
||||
public byte[] nullBytes;
|
||||
public int[] nullInts;
|
||||
|
||||
public List<String> strings = Lists.newArrayList("one", "two", "three");
|
||||
public List<String> nullStrings;
|
||||
|
||||
@Override
|
||||
public boolean equals (Object other)
|
||||
{
|
||||
@@ -67,6 +72,10 @@ public class ASStreamableSubset extends SimpleStreamableObject
|
||||
Arrays.equals(bools, ow.bools) && Arrays.equals(bytes, ow.bytes)
|
||||
&& Arrays.equals(ints, ow.ints) &&
|
||||
|
||||
Arrays.equals(nullBools, ow.nullBools) && Arrays.equals(nullBytes, ow.nullBytes);
|
||||
Arrays.equals(nullBools, ow.nullBools) && Arrays.equals(nullBytes, ow.nullBytes)
|
||||
&& Arrays.equals(nullInts, ow.nullInts)
|
||||
&&
|
||||
|
||||
Objects.equal(strings, ow.strings) && Objects.equal(nullStrings, ow.nullStrings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,11 +345,8 @@ public class StreamableTest
|
||||
oout.writeObject(w);
|
||||
byte[] data = bout.toByteArray();
|
||||
|
||||
// uncomment this and rerun the tests to generate an updated WIRE_DATA blob:
|
||||
// String dstr = StringUtil.wordWrap(StringUtil.hexlate(data), 80);
|
||||
// dstr = StringUtil.join(dstr.split("\n"), "\" +\n \"");
|
||||
// System.out.println(" protected static final byte[] WIRE_DATA = " +
|
||||
// "StringUtil.unhexlate(\n \"" + dstr + "\");");
|
||||
// uncomment this and rerun the tests to generate an updated WIRE_DATA blob
|
||||
// printWireData(w);
|
||||
|
||||
// oddly, JUnit doesn't like comparing byte arrays directly (this fails:
|
||||
// assertEquals(WIRE_DATA, WIRE_DATA.clone())), but comparing strings is fine
|
||||
@@ -360,6 +357,18 @@ public class StreamableTest
|
||||
assertEquals(w, oin.readObject());
|
||||
}
|
||||
|
||||
protected void printWireData (Object o)
|
||||
throws IOException
|
||||
{
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oout = new ObjectOutputStream(bout);
|
||||
oout.writeObject(o);
|
||||
String dstr = StringUtil.wordWrap(StringUtil.hexlate(bout.toByteArray()), 80);
|
||||
dstr = StringUtil.join(dstr.split("\n"), "\" +\n \"");
|
||||
System.out.println(" protected static final byte[] WIRE_DATA = "
|
||||
+ "StringUtil.unhexlate(\n \"" + dstr + "\");");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPostStreamingMutation ()
|
||||
throws IOException, ClassNotFoundException
|
||||
|
||||
Reference in New Issue
Block a user