@@ -448,6 +448,26 @@ func (s *MessageSuite) TestReBuildWithRepeatingGroupMultipleEntriesInGroupForRes
448448 s .True (bytes .Equal (expectedResendBytes , resendBytes ), "Unexpected bytes,\n expected: %s\n but was: %s" , expectedResendBytes , resendBytes )
449449}
450450
451+ func (s * MessageSuite ) TestReBuildWithRepeatingGroupWithDictionaryForResend () {
452+ dict , dictErr := datadictionary .Parse ("spec/FIX44.xml" )
453+ s .Nil (dictErr )
454+
455+ // A message whose body ends in a repeating group (453), parsed WITH a
456+ // dictionary so parseGroup handles the group.
457+ rawMsg := bytes .NewBufferString (
458+ "8=FIX.4.4\x01 9=165\x01 35=D\x01 34=2\x01 49=01001\x01 50=01001a\x01 52=20231231-20:19:41\x01 56=TEST\x01 " +
459+ "1=acct1\x01 11=13976\x01 21=1\x01 38=1\x01 40=2\x01 44=12\x01 54=1\x01 55=SYMABC\x01 59=0\x01 60=20231231-20:19:41\x01 453=1\x01 448=4501\x01 447=D\x01 452=28\x01 " +
460+ "10=026\x01 " )
461+ s .Nil (ParseMessageWithDataDictionary (s .msg , rawMsg , dict , dict ))
462+
463+ // The trailer must not stay embedded in bodyBytes.
464+ s .False (bytes .Contains (s .msg .bodyBytes , []byte ("\x01 10=" )), "trailer leaked into bodyBytes: %s" , s .msg .bodyBytes )
465+
466+ // A resend rebuilt from bodyBytes must carry exactly one 10= checksum.
467+ resendBytes := s .msg .buildWithBodyBytes (s .msg .bodyBytes )
468+ s .Equal (1 , bytes .Count (resendBytes , []byte ("\x01 10=" )), "expected exactly one 10= checksum, got: %s" , resendBytes )
469+ }
470+
451471func (s * MessageSuite ) TestReverseRoute () {
452472 s .Nil (ParseMessage (s .msg , bytes .NewBufferString ("8=FIX.4.29=17135=D34=249=TW50=KK52=20060102-15:04:0556=ISLD57=AP144=BB115=JCD116=CS128=MG129=CB142=JV143=RY145=BH11=ID21=338=10040=w54=155=INTC60=20060102-15:04:0510=123" )))
453473
0 commit comments