@@ -41,6 +41,12 @@ private static JBBPTextWriter makeWriter() {
4141 return new JBBPTextWriter (new StringWriter (), JBBPByteOrder .BIG_ENDIAN , "\n " , 16 , "0x" , "." , ";" , "~" , "," );
4242 }
4343
44+ @ Test
45+ public void testMakeStrWriter () throws Exception {
46+ final String generated = JBBPTextWriter .makeStrWriter ().Int (12 ).Byte (34 ).BR ().Comment ("Huzzaaa" ).Close ().toString ();
47+ assertEquals (String .format (".0x0000000C,0x22%n;Huzzaaa" ),generated );
48+ }
49+
4450 @ Test
4551 public void testConstructor_Default () {
4652 final JBBPTextWriter writer = new JBBPTextWriter ();
@@ -729,7 +735,7 @@ class SomeClass {
729735 @ Bin (outOrder = 6 , comment = "some string" )
730736 String str = "Hello String" ;
731737 @ Bin (outOrder = 7 , comment = "some string array" )
732- String [] strs = new String [] {"Hello" , null , "World" };
738+ String [] strs = new String [] {"Hello" , null , "World" };
733739 }
734740
735741 final SomeClass cl = new SomeClass ();
@@ -860,6 +866,19 @@ public void testBin_AllEasyTypes_NonMappedRawStruct() throws Exception {
860866 assertFile ("txtwrtrjbbpobj1.txt" , text );
861867 }
862868
869+ @ Test
870+ public void testBin_ValField () throws Exception {
871+ final JBBPParser parser = JBBPParser .prepare ("val:123 a;" );
872+ final String text = makeWriter ().SetMaxValuesPerLine (16 ).Bin (parser .parse (new byte [0 ])).Close ().toString ();
873+ assertEquals ("~--------------------------------------------------------------------------------\n " +
874+ "; Start {} \n " +
875+ "~--------------------------------------------------------------------------------\n " +
876+ " .0x0000007B; int a\n " +
877+ "~--------------------------------------------------------------------------------\n " +
878+ "; End {} \n " +
879+ "~--------------------------------------------------------------------------------\n " , text );
880+ }
881+
863882 @ Test
864883 public void testBin_AllEasyTypes_Anonymous_NonMappedRawStruct () throws Exception {
865884 final JBBPParser parser = JBBPParser .prepare ("bit:2; bit:6; byte; ubyte; short; ushort; int; long; bool; stringj;" );
0 commit comments