<reponame>jessemyers/pluscal<filename>pluscal/tests/builders/test_either.py<gh_stars>1-10
from textwrap import dedent

from hamcrest import assert_that, equal_to, is_

from pluscal.ast import Skip
from pluscal.builders.either import EitherBuilder


class TestEitherBuilder:

    def test_either(self) -> None:
        builder = EitherBuilder(Skip(), Skip())

        assert_that(
            str(builder),
            is_(equal_to(dedent("""\
                either
                  skip;
                  skip;
                end either;"""))),
        )

    def test_either_or(self) -> None:
        builder = EitherBuilder(Skip(), Skip()).or_(Skip()).or_(Skip())

        assert_that(
            str(builder),
            is_(equal_to(dedent("""\
                either
                  skip;
                  skip;
                or
                  skip;
                or
                  skip;
                end either;"""))),
        )
