test(parser): pin the trailing comment of a TEXT and GLOBL header

Assisted-by: GLM 5.3 Flash
This commit is contained in:
petrbalvin committed 2026-10-07 21:50:20 +02:00
1 parent 6f3e054bab
commit a9ee2bc702
3 files changed
+22 -5

No files matched your search

+13
View File
@@ -226,3 +226,16 @@ func TestGloblFlagsOperand(t *testing.T) {
t.Errorf("failed operand must carry no value")
}
}
// TestTrailingCommentInHeader covers the comment a directive line carries:
// it is the line's trailing text, the operand split hands the frame over
// before it, and the header parses exactly as it would without it.
func TestTrailingCommentInHeader(t *testing.T) {
txt := parseTextHeader(t, "TEXT \u00b7f(SB), NOSPLIT, $0 /* d */")
if !slices.Equal(txt.Flags, []string{"NOSPLIT"}) {
t.Errorf("flags = %v, want [NOSPLIT]", txt.Flags)
}
if txt.FlagVal != 4 || txt.Frame == nil || !txt.Frame.Imm.HasVal || txt.Frame.Imm.Val != 0 {
t.Errorf("val = %d frame = %+v, want 4 and $0", txt.FlagVal, txt.Frame)
}
}