Skip to content

Commit

Permalink
set profile for place tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thatstoasty committed Dec 21, 2024
1 parent 45a487b commit 34c0cba
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/test_whitespace.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@ from mog.whitespace import WhitespaceRenderer, with_whitespace_background, with_


def test_with_whitespace_background():
# Use a renderer with a specific profile to ensure consistent output.
testing.assert_equal(
place(10, 3, mog.right, mog.bottom, "hello", with_whitespace_background[mog.Color(2)]()),
mog.Renderer(mog.ANSI).place(10, 3, mog.right, mog.bottom, "hello", with_whitespace_background[mog.Color(2)]()),
"\x1b[;42m \x1b[0m\n\x1b[;42m \x1b[0m\n\x1b[;42m \x1b[0mhello"
)


def test_with_whitespace_foreground():
testing.assert_equal(
place(10, 3, mog.left, mog.center, "hello", with_whitespace_foreground[mog.Color(2)]()),
mog.Renderer(mog.ANSI).place(10, 3, mog.left, mog.center, "hello", with_whitespace_foreground[mog.Color(2)]()),
"\x1b[;32m \x1b[0m\nhello\x1b[;32m \x1b[0m\n\x1b[;32m \x1b[0m"
)


def test_with_whitespace_chars():
testing.assert_equal(
place(10, 3, mog.center, mog.center, "hello", with_whitespace_chars["<>"]()),
mog.Renderer(mog.ANSI).place(10, 3, mog.center, mog.center, "hello", with_whitespace_chars["<>"]()),
"<><><><><>\n<><hello<>\n<><><><><>"
)

def test_multiple_whitespace_options():
testing.assert_equal(
place(10, 3, mog.center, mog.center, "hello", with_whitespace_chars["<>"](), with_whitespace_background[mog.Color(2)]()),
mog.Renderer(mog.ANSI).place(10, 3, mog.center, mog.center, "hello", with_whitespace_chars["<>"](), with_whitespace_background[mog.Color(2)]()),
"\x1b[;42m<><><><><>\x1b[0m\n\x1b[;42m<><\x1b[0mhello\x1b[;42m<>\x1b[0m\n\x1b[;42m<><><><><>\x1b[0m"
)

0 comments on commit 34c0cba

Please sign in to comment.