@@ -396,6 +396,58 @@ public async Task UnknownMemberNameFallsBackToTheHint()
396396 await Assert . That ( b ) . Contains ( "\" dup\" " ) ;
397397 }
398398
399+ // A helper that hides the Verify call without forwarding the caller-info attributes is not a
400+ // supported layout: the helper's one call is shared by every test that uses it, so an inline
401+ // snapshot spliced into it could only ever be right for one of them. The member floor makes
402+ // the layout fail explicitly rather than patch the helper. A helper that wants to take part
403+ // forwards the caller info and carries a Verify prefix, like any custom entry point
404+ [ Test ]
405+ public async Task AppendDoesNotReachAHelperDeclaredAboveTheMember ( )
406+ {
407+ var source = string . Join (
408+ "\n " ,
409+ "class Tests" ,
410+ "{" ,
411+ " static Task Run(string value) =>" ,
412+ " Verify(value);" ,
413+ "" ,
414+ " async Task Test() =>" ,
415+ " await Run(\" value\" );" ,
416+ "}" ) ;
417+
418+ var status = TryApply ( source , 4 , InlinePatchMode . Append , null , "new" , out _ , out var reason , memberName : "Test" ) ;
419+
420+ await Assert . That ( status ) . IsEqualTo ( PatchStatus . NotFound ) ;
421+ await Assert . That ( reason ) . Contains ( "No Verify or Throws call" ) ;
422+ }
423+
424+ // When the member's own body has a Verify call, the floor confines the search to it even
425+ // though the hint points above the declaration
426+ [ Test ]
427+ public async Task AppendPrefersACallInsideTheMemberOverAHelperAbove ( )
428+ {
429+ var source = string . Join (
430+ "\n " ,
431+ "class Tests" ,
432+ "{" ,
433+ " static Task Run(string value) =>" ,
434+ " Verify(value);" ,
435+ "" ,
436+ " async Task Test()" ,
437+ " {" ,
438+ " await Verify(direct);" ,
439+ " await Run(\" value\" );" ,
440+ " }" ,
441+ "}" ) ;
442+
443+ var status = TryApply ( source , 4 , InlinePatchMode . Append , null , "new" , out var newSource , out _ , memberName : "Test" ) ;
444+
445+ await Assert . That ( status ) . IsEqualTo ( PatchStatus . Applied ) ;
446+ await Assert . That ( newSource ) . Contains (
447+ " await Verify(direct)\n " +
448+ " .Snapshot(\" new\" );" ) ;
449+ }
450+
399451 [ Test ]
400452 public async Task ExpressionWinsOverValue ( )
401453 {
0 commit comments