summaryrefslogtreecommitdiff
path: root/scss/tests/test_cli.py
blob: 053870a5a4ecbdf5d499817866cd2d563f02b0ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Test the command-line tool from the outside."""
from subprocess import PIPE, Popen

# TODO: this needs way, way, way, way more tests


def test_stdio():
    proc = Popen(
        ['python', '-m', 'scss.tool', '-C'],
        stdin=PIPE,
        stdout=PIPE,
        # this automatically handles encoding/decoding on py3
        universal_newlines=True,
    )
    out, _ = proc.communicate("""
        $color: red;

        table {
            td {
                color: $color;
            }
        }
    """)

    assert out == """\
table td {
  color: red;
}
"""