using ClaudeDo.Worker.Runner;

namespace ClaudeDo.Worker.Tests.Runner;

public class RetryPromptTests
{
    [Fact]
    public void Generic_no_result_error_is_not_appended()
    {
        var prompt = TaskRunner.BuildRetryPrompt($"{ClaudeProcess.NoResultPrefix} 1 and no result.");
        Assert.DoesNotContain("Captured error", prompt);
        Assert.Contains("did not complete", prompt);
    }

    [Fact]
    public void Real_error_is_appended()
    {
        var prompt = TaskRunner.BuildRetryPrompt("error CS1002: ; expected");
        Assert.Contains("Captured error", prompt);
        Assert.Contains("CS1002", prompt);
    }

    [Fact]
    public void Null_error_yields_bare_prompt()
    {
        var prompt = TaskRunner.BuildRetryPrompt(null);
        Assert.DoesNotContain("Captured error", prompt);
    }
}
