@@ -296,3 +296,53 @@ func TestNewScorer_Success(t *testing.T) {
296296 require .NoError (t , err )
297297 assert .NotNil (t , s )
298298}
299+
300+ func TestCheck_MessageNoConcatenationWhenExamplesPresent (t * testing.T ) {
301+ // When verbose cues are found, the diagnostic message must include
302+ // the cue examples in a single fmt.Sprintf rather than via `message +=`
303+ // concatenation. This test verifies the combined message format so the
304+ // implementation cannot silently drop the cue text.
305+ src := []byte (verboseParagraph () + "\n " )
306+ f , err := lint .NewFile ("test.md" , src )
307+ require .NoError (t , err )
308+
309+ threshold := modelConciseness (t )
310+ r := & Rule {MinScore : threshold , MinWords : 20 }
311+ diags := r .Check (f )
312+ if len (diags ) == 0 {
313+ t .Skip ("model threshold did not trigger on fixture" )
314+ }
315+ msg := diags [0 ].Message
316+ // The message must contain both the score summary and the cue guidance.
317+ assert .Contains (t , msg , "conciseness score too low" )
318+ assert .Contains (t , msg , "target >=" )
319+ // verboseParagraph always triggers cue detection; both must be present.
320+ assert .Contains (t , msg , "reduce verbose cues" )
321+ assert .Contains (t , msg , "e.g.," , "message with cues must include formatted examples" )
322+ }
323+
324+ func TestCheck_NoCuesMessage (t * testing.T ) {
325+ // Exercises the if examples == "" branch: a paragraph that scores as
326+ // verbose but produces no cue phrases yields the base message only.
327+ noCuePara := "When the configuration is set, the setting is used by the " +
328+ "configuration. The configuration uses the setting and the setting " +
329+ "configures the configuration."
330+ s , err := NewScorer ()
331+ require .NoError (t , err )
332+ scored := s .Score (noCuePara )
333+ if len (scored .Cues ) > 0 {
334+ t .Skip ("scorer detected cues in fixture; model may have drifted" )
335+ }
336+
337+ src := []byte (noCuePara + "\n " )
338+ f , err := lint .NewFile ("test.md" , src )
339+ require .NoError (t , err )
340+
341+ r := & Rule {MinScore : scored .Conciseness + 0.10 , MinWords : 1 }
342+ diags := r .Check (f )
343+ require .Len (t , diags , 1 , "expected diagnostic for low-scoring no-cue paragraph" )
344+ msg := diags [0 ].Message
345+ assert .Contains (t , msg , "conciseness score too low" )
346+ assert .Contains (t , msg , "target >=" )
347+ assert .NotContains (t , msg , "reduce verbose cues" , "no cues detected, so no cue guidance" )
348+ }
0 commit comments