Improved test, fixed bug
This commit is contained in:
		@@ -66,7 +66,8 @@ public class MPString implements MPType<String>, CharSequence {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void pack(OutputStream out) throws IOException {
 | 
			
		||||
        int size = value.length();
 | 
			
		||||
        byte[] bytes = value.getBytes(encoding);
 | 
			
		||||
        int size = bytes.length;
 | 
			
		||||
        if (size < 32) {
 | 
			
		||||
            out.write(FIXSTR_PREFIX + size);
 | 
			
		||||
        } else if (size < STR8_LIMIT) {
 | 
			
		||||
@@ -79,7 +80,7 @@ public class MPString implements MPType<String>, CharSequence {
 | 
			
		||||
            out.write(STR32_PREFIX);
 | 
			
		||||
            out.write(ByteBuffer.allocate(4).putInt(size).array());
 | 
			
		||||
        }
 | 
			
		||||
        out.write(value.getBytes(encoding));
 | 
			
		||||
        out.write(bytes);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ public class ReaderTest {
 | 
			
		||||
                new MPInteger(42),
 | 
			
		||||
                new MPMap<>(new HashMap<MPNil, MPNil>()),
 | 
			
		||||
                new MPNil(),
 | 
			
		||||
                new MPString("yay!") // TODO: emoji
 | 
			
		||||
                new MPString("yay! \uD83E\uDD13")
 | 
			
		||||
        );
 | 
			
		||||
        ByteArrayOutputStream out = new ByteArrayOutputStream();
 | 
			
		||||
        array.pack(out);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user