@@ -649,15 +649,14 @@ describe("ApplyDiffTool failure reporting", () => {
649649 } )
650650 } )
651651
652- // ApplyDiffTool.ts lines 108-110 hold the three comparisons that decide whether a replacement
653- // character already in the file is stepped over or reported as the failure position. Each byte
654- // sequence below was run through the tool in round U35 and the offset it prints is asserted here.
655- // The offsets each case must not print are the offsets the surviving mutants at those lines print
656- // instead; the changed-code mutation report numbers those rows one higher than the head lines
657- // (printed 109, 110, 111 for head 108, 109, 110), the shift I measured and named on the triage
658- // comment, so the bytes and the printed offset are the anchors, not the report line number. The
659- // mutant each case kills is named above it. The 0x41 and 0x3f cases are the shape where the
660- // replacement character is not at the start of the file, so the reported offset is one.
652+ // The guard below decides, from the bytes, whether a replacement character already in the file is
653+ // stepped over or reported as the failure position: it steps over only when the three bytes at the
654+ // current offset really are the encoded form of U+FFFD. Each byte sequence below was run through
655+ // the tool and the offset it prints is asserted here. The offsets each case must not print are the
656+ // offsets a mutant that stops stepping over, or steps by the wrong width, prints instead, so the
657+ // bytes and the printed offset are the anchors and no report line number is relied on. The mutant
658+ // each case kills is named above it. The 0x41 and 0x3f cases are the shape where the replacement
659+ // character is not at the start of the file, so the reported offset is one.
661660 describe ( "the guard that steps past an encoded replacement character" , ( ) => {
662661 async function runBytesFor ( bytes : Buffer ) : Promise < string > {
663662 mockedReadFile . mockResolvedValue ( bytes )
@@ -674,7 +673,7 @@ describe("ApplyDiffTool failure reporting", () => {
674673 return String ( pushedResult ?? "" )
675674 }
676675
677- // kills line 108 outer_or_and, line 108 inner_or_and, line 109 clauseB_false
676+ // kills first comparison outer_or_and, first comparison inner_or_and, second comparison clauseB_false
678677 it ( "reports offset 0 for the bytes 0xef 0xef 0xbd" , async ( ) => {
679678 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0xef , 0xbd ] ) )
680679
@@ -683,7 +682,7 @@ describe("ApplyDiffTool failure reporting", () => {
683682 expect ( output ) . not . toContain ( "offset 3)" )
684683 } )
685684
686- // kills line 108 outer_or_and, line 110 clauseC_false
685+ // kills first comparison outer_or_and, third comparison clauseC_false
687686 it ( "reports offset 0 for the bytes 0xef 0xbf 0xef" , async ( ) => {
688687 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0xbf , 0xef ] ) )
689688
@@ -692,7 +691,7 @@ describe("ApplyDiffTool failure reporting", () => {
692691 expect ( output ) . not . toContain ( "offset 3)" )
693692 } )
694693
695- // kills line 108 outer_or_and, line 110 clauseC_false
694+ // kills first comparison outer_or_and, third comparison clauseC_false
696695 it ( "reports offset 0 for the bytes 0xef 0xbf 0xff" , async ( ) => {
697696 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0xbf , 0xff ] ) )
698697
@@ -701,7 +700,7 @@ describe("ApplyDiffTool failure reporting", () => {
701700 expect ( output ) . not . toContain ( "offset 3)" )
702701 } )
703702
704- // kills line 108 outer_or_and, line 110 clauseC_false
703+ // kills first comparison outer_or_and, third comparison clauseC_false
705704 it ( "reports offset 0 for the bytes 0xef 0xbf 0x41" , async ( ) => {
706705 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0xbf , 0x41 ] ) )
707706
@@ -710,7 +709,7 @@ describe("ApplyDiffTool failure reporting", () => {
710709 expect ( output ) . not . toContain ( "offset 4)" )
711710 } )
712711
713- // kills line 108 outer_or_and, line 110 clauseC_false
712+ // kills first comparison outer_or_and, third comparison clauseC_false
714713 it ( "reports offset 0 for the bytes 0xef 0xbf 0x3f" , async ( ) => {
715714 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0xbf , 0x3f ] ) )
716715
@@ -719,7 +718,7 @@ describe("ApplyDiffTool failure reporting", () => {
719718 expect ( output ) . not . toContain ( "offset 4)" )
720719 } )
721720
722- // kills line 108 outer_or_and, line 108 inner_or_and, line 109 clauseB_false
721+ // kills first comparison outer_or_and, first comparison inner_or_and, second comparison clauseB_false
723722 it ( "reports offset 0 for the bytes 0xef 0xff 0xbd" , async ( ) => {
724723 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0xff , 0xbd ] ) )
725724
@@ -728,7 +727,7 @@ describe("ApplyDiffTool failure reporting", () => {
728727 expect ( output ) . not . toContain ( "offset 3)" )
729728 } )
730729
731- // kills line 108 outer_or_and, line 108 inner_or_and, line 109 clauseB_false
730+ // kills first comparison outer_or_and, first comparison inner_or_and, second comparison clauseB_false
732731 it ( "reports offset 0 for the bytes 0xef 0x41 0xbd" , async ( ) => {
733732 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0x41 , 0xbd ] ) )
734733
@@ -737,7 +736,7 @@ describe("ApplyDiffTool failure reporting", () => {
737736 expect ( output ) . not . toContain ( "offset 4)" )
738737 } )
739738
740- // kills line 108 outer_or_and, line 108 inner_or_and, line 109 clauseB_false
739+ // kills first comparison outer_or_and, first comparison inner_or_and, second comparison clauseB_false
741740 it ( "reports offset 0 for the bytes 0xef 0x3f 0xbd" , async ( ) => {
742741 const output = await runBytesFor ( Buffer . from ( [ 0xef , 0x3f , 0xbd ] ) )
743742
@@ -746,7 +745,7 @@ describe("ApplyDiffTool failure reporting", () => {
746745 expect ( output ) . not . toContain ( "offset 4)" )
747746 } )
748747
749- // kills line 108 outer_or_and, line 110 clauseC_false
748+ // kills first comparison outer_or_and, third comparison clauseC_false
750749 it ( "reports offset 1 for the bytes 0x41 0xef 0xbf" , async ( ) => {
751750 const output = await runBytesFor ( Buffer . from ( [ 0x41 , 0xef , 0xbf ] ) )
752751
@@ -755,7 +754,7 @@ describe("ApplyDiffTool failure reporting", () => {
755754 expect ( output ) . not . toContain ( "offset 4)" )
756755 } )
757756
758- // kills line 108 outer_or_and, line 110 clauseC_false
757+ // kills first comparison outer_or_and, third comparison clauseC_false
759758 it ( "reports offset 1 for the bytes 0x3f 0xef 0xbf" , async ( ) => {
760759 const output = await runBytesFor ( Buffer . from ( [ 0x3f , 0xef , 0xbf ] ) )
761760
@@ -764,7 +763,7 @@ describe("ApplyDiffTool failure reporting", () => {
764763 expect ( output ) . not . toContain ( "offset 4)" )
765764 } )
766765
767- // kills line 108 inner_or_and, line 108 clauseA_false
766+ // kills first comparison inner_or_and, first comparison clauseA_false
768767 it ( "reports offset 0 for the bytes 0xbf 0xbf 0xbd" , async ( ) => {
769768 const output = await runBytesFor ( Buffer . from ( [ 0xbf , 0xbf , 0xbd ] ) )
770769
@@ -773,7 +772,7 @@ describe("ApplyDiffTool failure reporting", () => {
773772 expect ( output ) . not . toContain ( "offset 3)" )
774773 } )
775774
776- // kills line 108 inner_or_and, line 108 clauseA_false
775+ // kills first comparison inner_or_and, first comparison clauseA_false
777776 it ( "reports offset 0 for the bytes 0xbd 0xbf 0xbd" , async ( ) => {
778777 const output = await runBytesFor ( Buffer . from ( [ 0xbd , 0xbf , 0xbd ] ) )
779778
@@ -782,7 +781,7 @@ describe("ApplyDiffTool failure reporting", () => {
782781 expect ( output ) . not . toContain ( "offset 3)" )
783782 } )
784783
785- // kills line 108 inner_or_and, line 108 clauseA_false
784+ // kills first comparison inner_or_and, first comparison clauseA_false
786785 it ( "reports offset 0 for the bytes 0xff 0xbf 0xbd" , async ( ) => {
787786 const output = await runBytesFor ( Buffer . from ( [ 0xff , 0xbf , 0xbd ] ) )
788787
0 commit comments