def test_append_tokens() -> None:
    """Regression test for https://github.com/Textualize/rich/issues/3014"""

    console = Console()
    t = Text().append_tokens(
        [
            (
                "long text that will be wrapped with a control code \r\n",
                "red",
            ),
        ]
    )
    with console.capture() as capture:
        console.print(t, width=40)

    output = capture.get()
    print(repr(output))
    assert output == "long text that will be wrapped with a \ncontrol code \n\n"
Regression test for https://github.com/Textualize/rich/issues/3014
tests/test_text.py